From 65d30add8dc0bcd4125a5dabbc14c33c5f90b1dd Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 22 May 2020 15:19:31 +0100 Subject: [PATCH] the results now consider punctuation and language when checking if a crown should be showed --- public/js/db.js | 4 ++-- public/js/script.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/js/db.js b/public/js/db.js index 2f1ca2e24..632f61ae4 100644 --- a/public/js/db.js +++ b/public/js/db.js @@ -32,12 +32,12 @@ async function db_getUserResults() { return ret; } -async function db_getUserHighestWpm(mode, mode2) { +async function db_getUserHighestWpm(mode, mode2, punctuation, language) { function cont() { let topWpm = 0; dbSnapshot.forEach(result => { - if (result.mode == mode && result.mode2 == mode2) { + if (result.mode == mode && result.mode2 == mode2 && result.punctuation == punctuation && result.language == language) { if (result.wpm > topWpm) { topWpm = result.wpm; } diff --git a/public/js/script.js b/public/js/script.js index 6494d3509..8028874a5 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -463,7 +463,7 @@ function showResult() { restartCount = 0; if (stats.wpm > 0 && stats.wpm < 600 && stats.acc > 50 && stats.acc <= 100) { if (firebase.auth().currentUser != null) { - db_getUserHighestWpm(config.mode, mode2).then(data => { + db_getUserHighestWpm(config.mode, mode2, config.punctuation, config.language).then(data => { // console.log(`highest wpm for this mode is ${data}, current is ${stats.wpm}`); if (data < stats.wpm) { showCrown();