Fixed display of growth rate in statistics info for huge values.

This commit is contained in:
23rd 2024-04-14 04:13:34 +03:00 committed by John Preston
parent a35f020f56
commit f4a09a9ca0
1 changed files with 3 additions and 1 deletions

View File

@ -349,12 +349,14 @@ void FillOverview(
const auto diffText = diffAbs > kTooMuchDiff
? Lang::FormatCountToShort(std::abs(diff)).string
: QString::number(diffAbs);
const auto percentage = std::abs(v.growthRatePercentage);
const auto precision = (percentage == int(percentage)) ? 0 : 1;
return {
(diff < 0 ? st::menuIconAttentionColor : st::settingsIconBg2)->c,
QString("%1%2 (%3%)")
.arg((diff < 0) ? QChar(0x2212) : QChar(0x002B))
.arg(diffText)
.arg(std::abs(std::round(v.growthRatePercentage * 10.) / 10.))
.arg(QString::number(percentage, 'f', precision))
};
};