Skip to content

fix: usage week aligns with UTC calendar week (#875) - #880

Merged
jakharmonika364 merged 1 commit into
Coder-s-OG-s:mainfrom
ionfwsrijan:fix/issue-875-usage-week-utc-calendar-window
Aug 4, 2026
Merged

fix: usage week aligns with UTC calendar week (#875)#880
jakharmonika364 merged 1 commit into
Coder-s-OG-s:mainfrom
ionfwsrijan:fix/issue-875-usage-week-utc-calendar-window

Conversation

@ionfwsrijan

Copy link
Copy Markdown
Contributor

Problem

Usage XP windows used a rolling 7x24-hour window that did not match the database's date_trunc('week') grouping, so award totals, grouping, and cleanup could disagree about which "week" a contribution belonged to ? especially at week boundaries.

Fix

  • The usage week now aligns with the UTC calendar week: it starts at the Monday 00:00 UTC boundary computed via Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() - daysSinceMonday), matching date_trunc('week').

Files changed

  • src/app/actions/usage.ts
  • Tests (usage actions + regression boundary test)

Testing

  • Full MergeShip suite passes.
  • New regression test pins the boundary between calendar weeks.

Closes #875

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@ionfwsrijan is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Hey @ionfwsrijan

You have 7 open PRs right now. The limit is 3 at a time.

Please get your existing PRs merged or closed before opening new ones:

This PR will remain open but won't be reviewed until you're under the limit. See our Contributing Guidelines for details.

@ionfwsrijan

Copy link
Copy Markdown
Contributor Author

@jakharmonika364 @Soumya-codr Please review this

@jakharmonika364 jakharmonika364 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers! LGTM

@jakharmonika364
jakharmonika364 merged commit cdc109e into Coder-s-OG-s:main Aug 4, 2026
3 of 4 checks passed
@ecsoc-sentinel ecsoc-sentinel Bot added ECSoC26-L1 Easy and removed ECSoC26-L1 Easy labels Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants