mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 15:05:22 +02:00
Fix Weeks of Coverage: Exclude partial current week from calculation
This commit is contained in:
@@ -1820,8 +1820,12 @@ export const calculateVelocityMap = (data: SalesRecord[]): Map<string, number> =
|
||||
const latestWeek = yearData.length > 0 ? Math.max(...yearData.map(r => r.week).filter(w => w !== undefined) as number[]) : 0;
|
||||
|
||||
const last4WeeksKeys = new Set<string>();
|
||||
// Start from previous week to ensure we use COMPLETED weeks
|
||||
// If raw data includes current partial week, we skip it.
|
||||
const startWeek = latestWeek - 1;
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
let w = latestWeek - i;
|
||||
let w = startWeek - i;
|
||||
let y = latestYear;
|
||||
if (w <= 0) {
|
||||
w = 52 + w;
|
||||
|
||||
Reference in New Issue
Block a user