From 7f46d6774effdf14e382d72993320821041e55cd Mon Sep 17 00:00:00 2001 From: bot-frontend Date: Sat, 30 May 2026 18:36:32 +0300 Subject: [PATCH] =?UTF-8?q?fix(tradein):=20guard=20=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BD=D0=B0=20median=3D0=20=D0=B2?= =?UTF-8?q?=20ListingsCard/DealsCard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit При пустой оценке (median_price_rub<=0) CV и «ниже рынка» делились на 0 → клиент видел «Infinity%»/«NaN%». Обёрнуто в guard m>0 ? ... : «—». Доп: знак сравнения сделок к рынку — «ниже»/«выше» по знаку diff. Refs #741 --- tradein-mvp/frontend/src/components/trade-in/DealsCard.tsx | 7 +++++-- .../frontend/src/components/trade-in/ListingsCard.tsx | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tradein-mvp/frontend/src/components/trade-in/DealsCard.tsx b/tradein-mvp/frontend/src/components/trade-in/DealsCard.tsx index 846ecea2..3e83312e 100644 --- a/tradein-mvp/frontend/src/components/trade-in/DealsCard.tsx +++ b/tradein-mvp/frontend/src/components/trade-in/DealsCard.tsx @@ -86,8 +86,11 @@ export function DealsCard({ estimate }: Props) { млн ₽
- на {(((estimate.median_price_rub - m) / estimate.median_price_rub) * 100).toFixed(0)}% - ниже рынка + {estimate.median_price_rub > 0 + ? `на ${Math.abs(((estimate.median_price_rub - m) / estimate.median_price_rub) * 100).toFixed(0)}% ${ + estimate.median_price_rub - m >= 0 ? "ниже" : "выше" + } рынка` + : "—"}
diff --git a/tradein-mvp/frontend/src/components/trade-in/ListingsCard.tsx b/tradein-mvp/frontend/src/components/trade-in/ListingsCard.tsx index 8a9e1123..8820700e 100644 --- a/tradein-mvp/frontend/src/components/trade-in/ListingsCard.tsx +++ b/tradein-mvp/frontend/src/components/trade-in/ListingsCard.tsx @@ -150,7 +150,12 @@ export function ListingsCard({ estimate, estimateId }: Props) { млн
-
CV {(((estimate.range_high_rub - estimate.range_low_rub) / m) * 100).toFixed(1)}%
+
+ CV{" "} + {m > 0 + ? `${(((estimate.range_high_rub - estimate.range_low_rub) / m) * 100).toFixed(1)}%` + : "—"} +
-- 2.45.3