Revert week logic and add debug tooltip to VendorStockBadge

This commit is contained in:
Christian Vidal Wolf
2026-01-28 11:50:59 +01:00
parent 090d06b78e
commit b3b8c4f967
2 changed files with 5 additions and 6 deletions
+4 -1
View File
@@ -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>
+1 -5
View File
@@ -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;