fix(tradein): guard деления на median=0 в ListingsCard/DealsCard (#741) #744

Merged
bot-reviewer merged 1 commit from feat/741-divzero-guards into main 2026-05-30 15:40:02 +00:00
2 changed files with 11 additions and 3 deletions
Showing only changes of commit 7f46d6774e - Show all commits

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>