fix(working_time): compute duration for segments starting at midnight#23
Merged
Conversation
Working Time Log rows with from_time 00:00:00 kept duration 0 even when to_time was later the same day. Parent Working Time totals then ignored that segment. Cause: set_duration (and related helpers) used `if self.from_time`. timedelta(0) is falsy in Python, so midnight was skipped. Reproduce: 1. Create a Working Time with a log row from 00:00:00 to a later time (e.g. 07:44:00). 2. Save the document. 3. Row duration stays 0; working_time / project_time only include other rows. Fix: use `is not None` instead of truthiness for from_time and to_time.
Confidence Score: 5/5Safe to merge — a minimal, targeted fix to a well-described calculation bug with no side effects on existing valid inputs. The change is small and surgical: three guard conditions updated to use explicit None checks instead of truthiness. The only behaviorally significant change is in set_duration, where timedelta(0) being falsy caused midnight start times to silently produce zero duration. All other changes are either no-ops or stylistically equivalent. No files require special attention.
|
barredterra
reviewed
May 30, 2026
barredterra
approved these changes
May 30, 2026
Member
|
🎉 This PR is included in version 15.4.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Working Time Log rows with from_time 00:00:00 kept duration 0 even when to_time was later the same day. Parent Working Time totals then ignored that segment.
Cause:
set_duration (and related helpers) used
if self.from_time. timedelta(0) is falsy in Python, so midnight was skipped.Reproduce:
Fix:
use
is not Noneinstead of truthiness for from_time and to_time.