fix(sf-legacy): treat velocity=0 as 'no data' in MarketTab
User reports on /legacy/site-finder/[cad]: Велосити 0.0 м²/мес · Срок продаж — which is contradictory — if velocity were truly zero, sales period would be infinity. Root cause: backend returns 0 (not null) when competitors are unmapped to Objective ground truth (OBJ-3). The condition for 'unavailable' must catch both null and zero. Fix: getSalesPeriodMonths already treats velocitySqm <= 0 as null (line 41), but the HeadlineBar + KPI card read raw velocity and display '0.0 м²/мес' for zero. Same coercion applied at the source: velocityPerMonth = (raw != null && raw > 0) ? raw : null. Both HeadlineBar and KPI card now show '—' for zero velocity, matching the '—' shown for Срок продаж.
This commit is contained in:
parent
31474deca8
commit
237b391dfe
1 changed files with 6 additions and 1 deletions
|
|
@ -60,7 +60,12 @@ export function MarketTab({ data }: Props) {
|
|||
// competitors count as proxy for active (строящихся) count for now.
|
||||
const activeCount = data.competitors.length;
|
||||
const radiusKm = getRadiusKm(data);
|
||||
const velocityPerMonth = data.velocity?.monthly_velocity_sqm ?? null;
|
||||
// Treat zero velocity as "no data" — backend returns 0 when competitors
|
||||
// are unmapped to Objective ground truth (OBJ-3). Showing "0.0 м²/мес"
|
||||
// is misleading; "—" makes it clear data is unavailable.
|
||||
const velocityRaw = data.velocity?.monthly_velocity_sqm;
|
||||
const velocityPerMonth =
|
||||
velocityRaw != null && velocityRaw > 0 ? velocityRaw : null;
|
||||
const maxMixPct = getMaxMixPct(data);
|
||||
const salesPeriodMonths = getSalesPeriodMonths(data);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue