Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/ts/test/test-logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ export async function finish(difficultyFailed = false): Promise<void> {

//need one more calculation for the last word if test auto ended
if (TestInput.burstHistory.length !== TestInput.input.getHistory()?.length) {
const burst = TestStats.calculateBurst();
const burst = TestStats.calculateBurst(now);
TestInput.pushBurstToHistory(burst);
}

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/ts/test/test-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ export function setLastSecondNotRound(): void {
lastSecondNotRound = true;
}

export function calculateBurst(): number {
export function calculateBurst(endTime: number = performance.now()): number {
const containsKorean = TestInput.input.getKoreanStatus();
const timeToWrite = (performance.now() - TestInput.currentBurstStart) / 1000;
const timeToWrite = (endTime - TestInput.currentBurstStart) / 1000;
let wordLength: number;
wordLength = !containsKorean
? TestInput.input.current.length
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/ts/test/test-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1436,8 +1436,7 @@ export async function applyBurstHeatmap(): Promise<void> {

let burstlist = [...TestInput.burstHistory];

burstlist = burstlist.filter((x) => x !== Infinity);
burstlist = burstlist.filter((x) => x < 500);
burstlist = burstlist.filter((x) => x < 500 || x === Infinity);

const typingSpeedUnit = getTypingSpeedUnit(Config.typingSpeedUnit);
burstlist.forEach((burst, index) => {
Expand Down Expand Up @@ -1508,7 +1507,7 @@ export async function applyBurstHeatmap(): Promise<void> {
}

$("#resultWordsHistory .heatmapLegend .box" + index).html(
`<div>${string}</div>`,
`<div>${Misc.escapeHTML(string)}</div>`,
);
});

Expand Down Expand Up @@ -1974,7 +1973,7 @@ $(".pageTest #resultWordsHistory").on("mouseenter", ".words .word", (e) => {
.replace(/>/g, "&gt")}
</div>
<div class="speed">
${Format.typingSpeed(burst, { showDecimalPlaces: false })}
${isNaN(burst) ? "∞" : Format.typingSpeed(burst, { showDecimalPlaces: false })}
${Config.typingSpeedUnit}
</div>
</div>`,
Expand Down