Feature: Summarize timelogs by day, week and month - #503
Merged
Conversation
group_by now takes day, week and month alongside user, project and task. These reach the time report totals endpoint, which buckets the window server-side, so a weekly summary over 187 weeks is one call rather than 187 — the most costly repeated pattern in the production time tools. Rows land in a new periods array; groups still carries the entity dimensions. The endpoint keys its buckets by day of year or month number with no year, so the handler sends one request per calendar year and stitches the rows back together, merging the two clipped halves of a week that 1 January cut in two. The tool description states what no response reveals: every period in the window comes back, zeros included; the first and last are clipped to the window, so they can be shorter than a full week or month; weeks start on the calling user's own start-of-week setting, so two users can get different buckets from one query; and a week that is only a weekend is dropped when it carries no time. order_by and order_mode are rejected for a period grouping. Period rows are chronological, and accepting an ordering there would silently do nothing.
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.
Description
group_bynow takesday,weekandmonthalongsideuser,projectandtask. These reach the time report totals endpoint, which buckets the window server-side, so a weekly summary over 187 weeks is one call rather than 187 — the most costly repeated pattern in the production time tools. Rows land in a new periods array; groups still carry the entity dimensions.The endpoint keys its buckets by day of year or month number with no year, so the handler sends one request per calendar year and stitches the rows back together, merging the two clipped halves of a week that 1 January cut in two.
The tool description states what no response reveals: every period in the window comes back, zeros included; the first and last are clipped to the window, so they can be shorter than a full week or month; weeks start on the calling user's own start-of-week setting, so two users can get different buckets from one query; and a week that is only a weekend is dropped when it carries no time.
order_byandorder_modeare not supported for period grouping. Period rows are chronological, and accepting that ordering would do nothing.Type of Change
Testing
go test -v ./...)Checklist