mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 12:15:23 +02:00
Revert week logic and add debug tooltip to VendorStockBadge
This commit is contained in:
@@ -76,7 +76,10 @@ export const VendorStockBadge: React.FC<VendorStockBadgeProps> = ({ asin, vendor
|
||||
<span>{stock.toLocaleString('de-DE')}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span className={`text-[9px] font-black uppercase tracking-tight whitespace-nowrap ${wocColor}`}>
|
||||
<span
|
||||
className={`text-[9px] font-black uppercase tracking-tight whitespace-nowrap ${wocColor}`}
|
||||
title={`Avg Sales (4wk): ${velocity.toFixed(2)} | Stock: ${stock}`}
|
||||
>
|
||||
{wocText}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -1820,12 +1820,8 @@ 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 = startWeek - i;
|
||||
let w = latestWeek - i;
|
||||
let y = latestYear;
|
||||
if (w <= 0) {
|
||||
w = 52 + w;
|
||||
|
||||
Reference in New Issue
Block a user