diff options
Diffstat (limited to 'overlays/worktime')
-rwxr-xr-x | overlays/worktime/worktime/__main__.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/overlays/worktime/worktime/__main__.py b/overlays/worktime/worktime/__main__.py index 6ce1331a..b0ac57e1 100755 --- a/overlays/worktime/worktime/__main__.py +++ b/overlays/worktime/worktime/__main__.py | |||
@@ -470,9 +470,9 @@ class Worktime(object): | |||
470 | 470 | ||
471 | self.time_to_work = sum([self.days_to_work[day] for day in self.days_to_work.keys() if day <= self.end_date.date()], timedelta()) | 471 | self.time_to_work = sum([self.days_to_work[day] for day in self.days_to_work.keys() if day <= self.end_date.date()], timedelta()) |
472 | for day in [d for d in list(self.pull_forward) if d > self.end_date.date()]: | 472 | for day in [d for d in list(self.pull_forward) if d > self.end_date.date()]: |
473 | days_forward = set([d for d in [start_day + timedelta(days = x) for x in range(0, (max(end_day, max(self.pull_forward.keys())) - start_day).days + 1)] if d >= self.end_date.date() and d < day and (not d in self.pull_forward or d == self.end_date.date())]) | 473 | days_forward = set([d for d in [start_day + timedelta(days = x) for x in range(0, (day - start_day).days + 1)] if d >= self.end_date.date() and d < day and (d not in self.pull_forward or d == self.end_date.date())]) |
474 | extra_days_forward = set([d for d in self.extra_days_to_work.keys() if d >= self.end_date.date() and d < day and (not d in self.pull_forward or d == self.end_date.date())]) | 474 | extra_days_forward = set([d for d in self.extra_days_to_work.keys() if d >= self.end_date.date() and d < day and (d not in self.pull_forward or d == self.end_date.date())]) |
475 | days_forward = days_forward.union(extra_days_forward) | 475 | days_forward |= extra_days_forward |
476 | 476 | ||
477 | extra_day_time_left = timedelta() | 477 | extra_day_time_left = timedelta() |
478 | for extra_day in extra_days_forward: | 478 | for extra_day in extra_days_forward: |
@@ -486,7 +486,7 @@ class Worktime(object): | |||
486 | self.extra_days_to_work[extra_day] += extra_day_time * (day_time / extra_day_time_left) | 486 | self.extra_days_to_work[extra_day] += extra_day_time * (day_time / extra_day_time_left) |
487 | 487 | ||
488 | hours_per_day_forward = time_forward / len(days_forward) if len(days_forward) > 0 else timedelta() | 488 | hours_per_day_forward = time_forward / len(days_forward) if len(days_forward) > 0 else timedelta() |
489 | # days_forward.discard(self.end_date.date()) | 489 | days_forward.discard(self.end_date.date()) |
490 | 490 | ||
491 | self.time_pulled_forward += time_forward - hours_per_day_forward * len(days_forward) | 491 | self.time_pulled_forward += time_forward - hours_per_day_forward * len(days_forward) |
492 | 492 | ||
@@ -610,7 +610,7 @@ def time_worked(now, waybar, **args): | |||
610 | out_text = None | 610 | out_text = None |
611 | out_class = "running" if now.running_entry else "stopped" | 611 | out_class = "running" if now.running_entry else "stopped" |
612 | tooltip = tooltip_timedelta(worked) | 612 | tooltip = tooltip_timedelta(worked) |
613 | target_time = max(then.time_per_day(then.now.date()), now.time_per_day(now.now.date())) if then.time_per_day(then.now.date()) and now.time_per_day(now.now.date()) else (then.time_per_day(then.now.date()) if then.time_per_day(then.now.date()) else now.time_per_day(now.now.date())); | 613 | target_time = max(then.time_per_day(then.now.date()), now.time_per_day(now.now.date())) if then.time_per_day(then.now.date()) and now.time_per_day(now.now.date()) else (then.time_per_day(then.now.date()) if then.time_per_day(then.now.date()) else now.time_per_day(now.now.date())) |
614 | difference = target_time - worked | 614 | difference = target_time - worked |
615 | difference_pull_forward = difference + now.time_pulled_forward | 615 | difference_pull_forward = difference + now.time_pulled_forward |
616 | if now.running_entry and difference_pull_forward < timedelta(seconds=0): | 616 | if now.running_entry and difference_pull_forward < timedelta(seconds=0): |
@@ -641,7 +641,7 @@ def time_worked(now, waybar, **args): | |||
641 | 641 | ||
642 | clockout_time, exact_clockout_time, clockout_difference = round_clockout_time(difference) | 642 | clockout_time, exact_clockout_time, clockout_difference = round_clockout_time(difference) |
643 | clockout_time_pull_forward, exact_clockout_time_pull_forward, clockout_difference_pull_forward = round_clockout_time(difference_pull_forward) | 643 | clockout_time_pull_forward, exact_clockout_time_pull_forward, clockout_difference_pull_forward = round_clockout_time(difference_pull_forward) |
644 | clockout_pull_forward_sum, exact_clockout_pull_forward_sum, _ = round_clockout_time(now.time_to_work - now.time_worked + sum(now.pull_forward.values(), start=timedelta(milliseconds=0))) | 644 | clockout_pull_forward_sum, exact_clockout_pull_forward_sum, _ = round_clockout_time(now.time_to_work - now.time_pulled_forward - now.time_worked + sum(now.pull_forward.values(), start=timedelta(milliseconds=0))) |
645 | 645 | ||
646 | if now.running_entry and clockout_time and (clockout_difference >= 0 or clockout_difference_pull_forward >= 0): | 646 | if now.running_entry and clockout_time and (clockout_difference >= 0 or clockout_difference_pull_forward >= 0): |
647 | out_text = f"{difference_string}/{clockout_time:%H:%M}" | 647 | out_text = f"{difference_string}/{clockout_time:%H:%M}" |