Skip to content

feat: week_start counts week_seconds for the calendar week - #53

Merged
itsthisjustin merged 2 commits into
crosspoint-reader:mainfrom
eszter007:feat/overview-week-start
Oct 26, 2026
Merged

itsthisjustin merged 2 commits into
crosspoint-reader:mainfrom
eszter007:feat/overview-week-start

Conversation

@eszter007

@eszter007 eszter007 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

GET /api/v1/stats/overview gives week_seconds for the last 7 days. A reader that shows the calendar week can't get that number from the digest, so it would show a different week than the device's own stats.

This adds week_start=0 (week from Sunday) and week_start=1 (from Monday): week_seconds then counts the days since the week started, through today, at the top level and in every groups entry. Without the parameter nothing changes. Any other value is refused like the other invalid parameters.

Tested: a new case in test/stats-overview.test.ts (Wednesday 2026-10-21, reading last Thursday, Sunday, Monday and today: 1540 rolling, 1440 from Sunday, 840 from Monday). Also checked against a local server with mock X4 uploads. Full suite passes, tsc clean. docs/API.md updated.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 10ca6123-a61d-4182-be79-cc703425a71a
Commits

Reviewing files that changed from the base of the PR and between e41072c and c3df46a.

Files selected for processing: 3
  • docs/API.md
  • src/routes/v1/stats.ts
  • test/stats-overview.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Recent review details
Additional comments: 3
docs/API.md: 1

594-594: LGTM!

Also applies to: 611-612

src/routes/v1/stats.ts: 1

420-425: LGTM!

Also applies to: 432-434, 463-463

test/stats-overview.test.ts: 1

51-80: LGTM!

Walkthrough

The overview endpoint now accepts an optional week_start parameter. It uses Sunday or Monday as the calendar-week start when selected, and retains the seven-day window when the parameter is omitted.

Changes: Overview weekly window

Layer / File(s) Summary
Week start window
docs/API.md, src/routes/v1/stats.ts, test/stats-overview.test.ts
The route accepts week_start=0 for Sunday and week_start=1 for Monday, and rejects other values. Without the parameter, it retains the seven-day window. Tests cover total and language-grouped weekly seconds for each case. The API documentation describes the parameter and behavior.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related PRs

Suggested reviewers: itsthisjustin

Merge Risk: Minimal · up to c3df4

No merge-blocking issue is identified for the optional week-start behavior; it is ready for normal merge checks.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: adding week_start support for calendar-week week_seconds calculations.
Description check Passed The description directly explains the week_start behavior, unchanged default behavior, validation, tests, and documentation update.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@eszter007 eszter007 changed the title feat: week_start=1 counts week_seconds from Monday in the overview feat: week_start counts week_seconds for the calendar week Oct 26, 2026
@eszter007
eszter007 marked this pull request as ready for review October 26, 2026 13:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-26T13:10:57.533144Z
We couldn’t complete this review. Comment @codex review to try again.
c3df46a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@itsthisjustin
itsthisjustin merged commit 78d8801 into crosspoint-reader:main Oct 26, 2026
4 checks passed
@eszter007
eszter007 deleted the feat/overview-week-start branch October 26, 2026 13:21
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.

2 participants