mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 12:35:24 +02:00
fix(experimentAnalysis): use ISO week start (Monday) consistently in aggregateWeeklyMetrics
- Change getWeekStartSunday to getISOWeekMonday for timestamp calculation - Ensures week alignment between data aggregation and ISO week range calculation - Fixes incorrect treatment_after average calculation Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
co-authored by
Qwen-Coder
parent
d5936f1301
commit
918da227ee
@@ -148,9 +148,10 @@ function aggregateWeeklyMetrics(
|
|||||||
const key = `${year}-W${String(weekNum).padStart(2, '0')}`;
|
const key = `${year}-W${String(weekNum).padStart(2, '0')}`;
|
||||||
|
|
||||||
if (!weeklyMap.has(key)) {
|
if (!weeklyMap.has(key)) {
|
||||||
|
// Use ISO week start (Monday) instead of Sunday for consistency
|
||||||
weeklyMap.set(key, {
|
weeklyMap.set(key, {
|
||||||
week: key,
|
week: key,
|
||||||
timestamp: getWeekStartSunday(year, weekNum),
|
timestamp: getISOWeekMonday(year, weekNum),
|
||||||
units: 0,
|
units: 0,
|
||||||
revenue: 0,
|
revenue: 0,
|
||||||
adRevenue: 0,
|
adRevenue: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user