Skip to content

Commit

Permalink
* Fix handling report/log 'from_' shifting by 'day_start_hour'
Browse files Browse the repository at this point in the history
  • Loading branch information
sfider committed Nov 24, 2024
1 parent 59ee276 commit 53fa898
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions watson/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
get_rename_types,
get_tags,
)
from .frames import Frame
from .frames import Frame, shifted_floor
from .utils import (
apply_weekday_offset,
build_csv,
Expand Down Expand Up @@ -1067,8 +1067,7 @@ def log(watson, current, reverse, from_, to, projects, tags, ignore_projects,
from_ = start_time

if from_ == from_.floor('day'):
hour_shift = watson.config.getint('options', 'day_start_hour', 0)
from_ = from_.shift(hours=hour_shift)
from_ = shifted_floor(from_, 'day')

if from_ > to:
raise click.ClickException("'from' must be anterior to 'to'")
Expand Down
5 changes: 2 additions & 3 deletions watson/watson.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import subprocess

from .config import ConfigParser
from .frames import Frames, set_hour_shift
from .frames import Frames, set_hour_shift, shifted_floor
from .utils import deduplicate, make_json_writer, safe_save, sorted_groupby
from .version import version as __version__ # noqa

Expand Down Expand Up @@ -536,8 +536,7 @@ def report(self, from_, to, current=None, projects=None, tags=None,
from_ = start_time

if from_ == from_.floor('day'):
hour_shift = self.config.getint('options', 'day_start_hour', 0)
from_ = from_.shift(hours=hour_shift)
from_ = shifted_floor(from_, 'day')

if not self._validate_report_options(projects, ignore_projects):
raise WatsonError(
Expand Down

0 comments on commit 53fa898

Please sign in to comment.