impr: show total completed test percentage and restarts/test on profile (fehmer) (#5169)

This commit is contained in:
Christian Fehmer 2024-03-04 14:18:34 +01:00 committed by GitHub
parent ca55b28135
commit d2d7b3e109
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -201,13 +201,34 @@ export async function update(
.attr("aria-label", hoverText)
.attr("data-balloon-break", "");
let completedPercentage = "";
let restartRatio = "";
if (
profile.typingStats.completedTests !== undefined &&
profile.typingStats.startedTests !== undefined
) {
completedPercentage = Math.floor(
(profile.typingStats.completedTests / profile.typingStats.startedTests) *
100
).toString();
restartRatio = (
(profile.typingStats.startedTests - profile.typingStats.completedTests) /
profile.typingStats.completedTests
).toFixed(1);
}
const typingStatsEl = details.find(".typingStats");
typingStatsEl
.find(".started .value")
.text(profile.typingStats?.startedTests ?? 0);
typingStatsEl
.find(".completed .value")
.text(profile.typingStats?.completedTests ?? 0);
.text(profile.typingStats?.completedTests ?? 0)
.attr("data-balloon-pos", "up")
.attr(
"aria-label",
`${completedPercentage}% (${restartRatio} restarts per completed test)`
);
typingStatsEl
.find(".timeTyping .value")
.text(