the results now consider punctuation and language when checking if a crown should be showed

This commit is contained in:
unknown 2020-05-22 15:19:31 +01:00
parent 18eff0cc31
commit 65d30add8d
2 changed files with 3 additions and 3 deletions

View file

@ -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;
}

View file

@ -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();