Skip to content

Feature: Summarize timelogs by day, week and month - #503

Merged
rafaeljusto merged 1 commit into
mainfrom
feature/time-totals
Aug 28, 2026
Merged

Feature: Summarize timelogs by day, week and month#503
rafaeljusto merged 1 commit into
mainfrom
feature/time-totals

Conversation

@rafaeljusto

Copy link
Copy Markdown
Contributor

Description

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 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_by and order_mode are not supported for period grouping. Period rows are chronological, and accepting that ordering would do nothing.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

  • Tests pass locally (go test -v ./...)
  • Added/updated tests for new functionality

Checklist

  • Code follows project style guidelines
  • Self-reviewed the code
  • Added necessary documentation
  • No new warnings or errors

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.
@rafaeljusto
rafaeljusto requested a review from a team as a code owner August 28, 2026 12:44
@rafaeljusto
rafaeljusto merged commit f80c066 into main Aug 28, 2026
4 checks passed
@rafaeljusto
rafaeljusto deleted the feature/time-totals branch August 28, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant