Skip to content

Commit d94a002

Browse files
fix(metrics): correct dashboard week boundary to Saturday
The dashboard window ended on Sunday instead of Saturday, so mid-week it requested a different window than the email and missed the warmed cache key. Align the exclusive end to the most recent Saturday so the page matches the email window and hits the warm cache. Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5ef7b2b commit d94a002

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

dashboard/src/pages/Metrics/MetricsPage.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -551,11 +551,8 @@ function LabsSection({ labs }: { labs: LabData[] }): JSX.Element {
551551
const getMetricsQueryParams = (
552552
activeDays: number,
553553
): { startDaysAgo: number; endDaysAgo: number } => {
554-
const today = new Date();
555-
const weekEndDaysAgo = (today.getUTCDay() + 1) % DAYS_IN_WEEK;
556-
const endDaysAgo = Math.max(weekEndDaysAgo - 1, 0);
557-
const startDaysAgo = endDaysAgo + activeDays;
558-
return { startDaysAgo, endDaysAgo };
554+
const endDaysAgo = (new Date().getUTCDay() + 1) % DAYS_IN_WEEK;
555+
return { startDaysAgo: endDaysAgo + activeDays, endDaysAgo };
559556
};
560557

561558
export const MetricsPage = (): JSX.Element => {

0 commit comments

Comments
 (0)