Add tests for 8-hour overview calculation with breaks between shifts#63
Open
jonatanskogsfors wants to merge 2 commits intodevelopfrom
Open
Add tests for 8-hour overview calculation with breaks between shifts#63jonatanskogsfors wants to merge 2 commits intodevelopfrom
jonatanskogsfors wants to merge 2 commits intodevelopfrom
Conversation
The overview calculation for "8 timmar" and "I fas med veckan" uses a simple formula (current_time - excess) that doesn't account for breaks between shifts. When a completed shift already covers 8 hours and a new shift starts after a break, the displayed time is wrong by the break duration. https://claude.ai/code/session_01K5CvYZ2wJtfigs4mEQWyGP
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.
Summary
This PR adds comprehensive test coverage for the day overview functionality, specifically validating that the "8 timmar" (8 hours) calculation correctly accounts for breaks between shifts.
Changes
test_overview_eight_hours_accounts_for_break_between_shifts(): Verifies that when an 8-hour workday is completed with a break in between shifts, the overview correctly shows the actual time when 8 hours was reached (16:45), not the start time of the next shift (17:00)test_overview_eight_hours_not_yet_reached_with_break(): Verifies that when 8 hours hasn't been reached yet, the overview correctly calculates and displays the projected completion time (18:00), accounting for the break between shiftsunittest.mock.patchimport to support mockingdatetime.now()for time-dependent assertionsImplementation Details
Both tests use mocking to control the current time and verify the overview output contains the expected time strings. The tests validate that the day overview logic properly:
https://claude.ai/code/session_01K5CvYZ2wJtfigs4mEQWyGP