fix(tradein): guard деления на median=0 в ListingsCard/DealsCard (#741) (#744)
All checks were successful
Deploy Trade-In / deploy (push) Successful in 34s
Deploy Trade-In / changes (push) Successful in 5s
Deploy Trade-In / test (push) Has been skipped
Deploy Trade-In / build-backend (push) Has been skipped
Deploy Trade-In / build-frontend (push) Successful in 1m33s

Co-authored-by: bot-frontend <bot-frontend@gendsgn.local>
Co-committed-by: bot-frontend <bot-frontend@gendsgn.local>
This commit is contained in:
bot-frontend 2026-05-30 15:40:01 +00:00 committed by bot-reviewer
parent 798fb12b4c
commit 2390c49d12
2 changed files with 11 additions and 3 deletions

View file

@ -86,8 +86,11 @@ export function DealsCard({ estimate }: Props) {
<span className="unit">млн </span>
</div>
<div className="sub">
на {(((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 ? "ниже" : "выше"
} рынка`
: "—"}
</div>
</div>
<div className="count-cell">

View file

@ -150,7 +150,12 @@ export function ListingsCard({ estimate, estimateId }: Props) {
</span>
<span className="unit">млн</span>
</div>
<div className="sub">CV {(((estimate.range_high_rub - estimate.range_low_rub) / m) * 100).toFixed(1)}%</div>
<div className="sub">
CV{" "}
{m > 0
? `${(((estimate.range_high_rub - estimate.range_low_rub) / m) * 100).toFixed(1)}%`
: "—"}
</div>
</div>
</div>