fixed today tracker including incomplete test seconds when failing a test

This commit is contained in:
Miodec 2021-07-15 15:42:25 +01:00
parent 61a90493b9
commit f37e62cd44

View file

@ -1253,13 +1253,14 @@ export function finish(difficultyFailed = false) {
if (afkSecondsPercent > 0) {
$("#result .stats .time .bottom .afk").text(afkSecondsPercent + "% afk");
}
TodayTracker.addSeconds(
testtime +
(TestStats.incompleteSeconds < 0
let ttseconds = testtime - afkseconds;
if (!difficultyFailed) {
ttseconds +=
TestStats.incompleteSeconds < 0
? 0
: Misc.roundTo2(TestStats.incompleteSeconds)) -
afkseconds
);
: Misc.roundTo2(TestStats.incompleteSeconds);
}
TodayTracker.addSeconds(ttseconds);
$("#result .stats .time .bottom .timeToday").text(TodayTracker.getString());
$("#result .stats .key .bottom").text(testtime + "s");
$("#words").removeClass("blurred");