mirror of
https://github.com/ankitects/anki.git
synced 2025-11-10 14:47:12 -05:00
More precise percent of days studied (#2889)
* More precise percent of days studied * Use localizedNumber & Format * Update reviews.ts * Update reviews.ts * Update reviews.ts
This commit is contained in:
parent
fd685f29fe
commit
ee68da51b0
1 changed files with 12 additions and 1 deletions
|
|
@ -327,6 +327,7 @@ export function renderReviews(
|
||||||
|
|
||||||
const periodDays = -xMin + 1;
|
const periodDays = -xMin + 1;
|
||||||
const studiedDays = sum(bins, (bin) => bin.length);
|
const studiedDays = sum(bins, (bin) => bin.length);
|
||||||
|
const studiedPercent = (studiedDays / periodDays) * 100;
|
||||||
const total = yCumMax;
|
const total = yCumMax;
|
||||||
const periodAvg = total / periodDays;
|
const periodAvg = total / periodDays;
|
||||||
const studiedAvg = total / studiedDays;
|
const studiedAvg = total / studiedDays;
|
||||||
|
|
@ -377,7 +378,17 @@ export function renderReviews(
|
||||||
value: tr.statisticsAmountOfTotalWithPercentage({
|
value: tr.statisticsAmountOfTotalWithPercentage({
|
||||||
amount: studiedDays,
|
amount: studiedDays,
|
||||||
total: periodDays,
|
total: periodDays,
|
||||||
percent: Math.round((studiedDays / periodDays) * 100),
|
percent: (() => {
|
||||||
|
if (studiedPercent < 99.5) {
|
||||||
|
return localizedNumber(studiedPercent);
|
||||||
|
} else if (studiedPercent < 99.95) {
|
||||||
|
return localizedNumber(studiedPercent, 1);
|
||||||
|
} else if (studiedPercent < 100) {
|
||||||
|
return localizedNumber(studiedPercent, 2);
|
||||||
|
} else {
|
||||||
|
return "100";
|
||||||
|
}
|
||||||
|
})(),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue