wip: round displayed durations to nearest 15 minutes#16
Open
Flyrell wants to merge 1 commit into
Open
Conversation
Displayed durations are now rounded to the nearest 15-minute interval across status, history, report (table and PDF export), and log output. This keeps timesheets readable without altering the underlying data: stored time remains precise and only the presentation is rounded. Adds RoundMinutes(m, interval) and FormatMinutesRounded(m) in internal/entry/duration.go, with table-driven tests. Display-only call sites swap FormatMinutes for FormatMinutesRounded. Interactive input defaults that round-trip through ParseDuration (log_edit.go duration prompt, report_overlay.go form fields) deliberately keep the unrounded FormatMinutes, so editing an entry never silently mutates its stored duration. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5702f9e to
46628e9
Compare
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
Displayed durations are now rounded to the nearest 15-minute interval. The rounding is display-only — stored time stays precise and logged data is never mutated.
RoundMinutes(m, interval int)andFormatMinutesRounded(m int)ininternal/entry/duration.go, with table-driven tests (duration_test.go).FormatMinutes→FormatMinutesRoundedat all display-only call sites:status,historylog add/log remove/log editdisplay linesreporttable view and PDF exportreportoverlay labels (entry selector, remove confirmation)find.go,placement.goerror messageFormatMinutesat the three interactive input-default sites that round-trip throughParseDuration(log_edit.go:368,report_overlay.go:94,report_overlay.go:244), so editing an entry never silently mutates its stored duration.CHANGELOG.mdwith an[Unreleased] > Changedentry.RoundMinutesrounds midpoints up (e.g. with interval 15: 7→0, 8→15) and returns the value unchanged for non-positive minutes orinterval <= 1.How to test
task test— covers the new table-driven tests forRoundMinutes/FormatMinutesRounded.hourgit status,hourgit history, andhourgit reporton data with non-15-aligned durations and confirm displayed times snap to the nearest 15 minutes while the stored entries remain unchanged.hourgit log edit <hash>) and confirm the duration prompt is pre-filled with the precise (unrounded) value, so saving without changes does not alter stored time.Notes for reviewer
🤖 Generated with Claude Code