fix(sf-legacy): velocity=0 → '—' в MarketTab (consistency со «Срок продаж») #362

Merged
lekss361 merged 1 commit from fix/legacy-market-velocity-zero-as-null into main 2026-05-18 04:16:51 +00:00
Owner

Summary

User на /legacy/site-finder/{cad}:

20 строящихся в 3км · велосити 0.0 м²/мес · рекомендуемый mix —
Активные ЖК: 20
Велосити: 0.0 м²/мес  ← misleading
Срок продаж: —          ← inconsistent

Если velocity действительно 0 → срок продаж был бы бесконечность, не «—». Backend возвращает 0 (не null) когда competitors не маппнуты к Objective ground truth (OBJ-3). Condition для «unavailable» должна ловить и null, и zero.

Fix

getSalesPeriodMonths уже treats velocitySqm <= 0 как null (line 41), но HeadlineBar + KPI card читают raw velocity → показывают 0.0 м²/мес. Same coercion применена at the source:

const velocityPerMonth = velocityRaw != null && velocityRaw > 0 ? velocityRaw : null;

После fix: HeadlineBar + KPI card показывают for zero velocity, consistent с уже-показываемым для Срок продаж.

Verify

После deploy: /legacy/site-finder/{cad} где velocity=0 → все три значения «Велосити», «Срок продаж», headline-bar показывают , не контрадиктивное 0.0 м²/мес.

## Summary User на `/legacy/site-finder/{cad}`: ``` 20 строящихся в 3км · велосити 0.0 м²/мес · рекомендуемый mix — Активные ЖК: 20 Велосити: 0.0 м²/мес ← misleading Срок продаж: — ← inconsistent ``` Если velocity действительно 0 → срок продаж был бы бесконечность, не «—». Backend возвращает `0` (не `null`) когда competitors не маппнуты к Objective ground truth (OBJ-3). Condition для «unavailable» должна ловить и null, и zero. ## Fix `getSalesPeriodMonths` уже treats `velocitySqm <= 0` как null (line 41), но HeadlineBar + KPI card читают raw velocity → показывают `0.0 м²/мес`. Same coercion применена at the source: ```ts const velocityPerMonth = velocityRaw != null && velocityRaw > 0 ? velocityRaw : null; ``` После fix: HeadlineBar + KPI card показывают `—` for zero velocity, consistent с уже-показываемым `—` для Срок продаж. ## Verify После deploy: `/legacy/site-finder/{cad}` где velocity=0 → все три значения «Велосити», «Срок продаж», headline-bar показывают `—`, не контрадиктивное `0.0 м²/мес`.
lekss361 added 1 commit 2026-05-18 04:14:56 +00:00
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 Срок продаж.
lekss361 merged commit f6ea27c4f5 into main 2026-05-18 04:16:51 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lekss361/gendesign#362
No description provided.