From 35db7c9021faac430499c7db14e715ea3db23eaf Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 12 Oct 2020 00:41:03 +0100 Subject: [PATCH 01/15] tracking timestamp with pbs --- functions/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/functions/index.js b/functions/index.js index 257eee7c4..724a22057 100644 --- a/functions/index.js +++ b/functions/index.js @@ -262,6 +262,7 @@ function checkIfPB(uid, obj, userdata) { wpm: obj.wpm, acc: obj.acc, raw: obj.rawWpm, + timestamp: Date.now() }, ], }, @@ -285,6 +286,7 @@ function checkIfPB(uid, obj, userdata) { wpm: obj.wpm, acc: obj.acc, raw: obj.rawWpm, + timestamp: Date.now() }, ], }, @@ -316,6 +318,7 @@ function checkIfPB(uid, obj, userdata) { pb.wpm = obj.wpm; pb.acc = obj.acc; pb.raw = obj.rawWpm; + pb.timestamp = Date.now(); toUpdate = true; } else { //no pb @@ -332,6 +335,7 @@ function checkIfPB(uid, obj, userdata) { wpm: obj.wpm, acc: obj.acc, raw: obj.rawWpm, + timestamp: Date.now() }); toUpdate = true; } @@ -346,6 +350,7 @@ function checkIfPB(uid, obj, userdata) { wpm: obj.wpm, acc: obj.acc, raw: obj.rawWpm, + timestamp: Date.now() }, ]; toUpdate = true; @@ -701,9 +706,13 @@ exports.testCompleted = functions return; } request = request.body.data; + if (request === undefined) { + response.status(200).send({ data: { resultCode: -999 } }); + return; + } try { if (request.uid === undefined || request.obj === undefined) { - console.error(`error saving result for ${request.uid} - missing input`); + console.error(`error saving result for - missing input`); response.status(200).send({ data: { resultCode: -999 } }); return; } From 24051eba5ef8fe353b81e22e6efcf49dfd9deed9 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 12 Oct 2020 00:46:29 +0100 Subject: [PATCH 02/15] local pb timestamp --- public/js/db.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/js/db.js b/public/js/db.js index 2de6cc3a3..a092a5398 100644 --- a/public/js/db.js +++ b/public/js/db.js @@ -225,6 +225,7 @@ async function db_saveLocalPB( pb.wpm = wpm; pb.acc = acc; pb.raw = raw; + pb.timestamp = Date.now(); } }); if (!found) { @@ -236,6 +237,7 @@ async function db_saveLocalPB( wpm: wpm, acc: acc, raw: raw, + timestamp: Date.now() }); } } catch (e) { @@ -249,6 +251,7 @@ async function db_saveLocalPB( wpm: wpm, acc: acc, raw: raw, + timestamp: Date.now() }, ]; } From f2b95ea5f0b819a1549e92e953a0388face2b4e1 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 12 Oct 2020 00:55:31 +0100 Subject: [PATCH 03/15] added consistency to pbs --- functions/index.js | 13 +++++++++---- public/js/db.js | 10 +++++++--- public/js/script.js | 1 + 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/functions/index.js b/functions/index.js index 724a22057..483b20459 100644 --- a/functions/index.js +++ b/functions/index.js @@ -262,7 +262,8 @@ function checkIfPB(uid, obj, userdata) { wpm: obj.wpm, acc: obj.acc, raw: obj.rawWpm, - timestamp: Date.now() + timestamp: Date.now(), + consistency: obj.consistency }, ], }, @@ -286,7 +287,8 @@ function checkIfPB(uid, obj, userdata) { wpm: obj.wpm, acc: obj.acc, raw: obj.rawWpm, - timestamp: Date.now() + timestamp: Date.now(), + consistency: obj.consistency }, ], }, @@ -319,6 +321,7 @@ function checkIfPB(uid, obj, userdata) { pb.acc = obj.acc; pb.raw = obj.rawWpm; pb.timestamp = Date.now(); + pb.consistency = obj.consistency; toUpdate = true; } else { //no pb @@ -335,7 +338,8 @@ function checkIfPB(uid, obj, userdata) { wpm: obj.wpm, acc: obj.acc, raw: obj.rawWpm, - timestamp: Date.now() + timestamp: Date.now(), + consistency: obj.consistency }); toUpdate = true; } @@ -350,7 +354,8 @@ function checkIfPB(uid, obj, userdata) { wpm: obj.wpm, acc: obj.acc, raw: obj.rawWpm, - timestamp: Date.now() + timestamp: Date.now(), + consistency: obj.consistency }, ]; toUpdate = true; diff --git a/public/js/db.js b/public/js/db.js index a092a5398..75a732730 100644 --- a/public/js/db.js +++ b/public/js/db.js @@ -207,7 +207,8 @@ async function db_saveLocalPB( difficulty, wpm, acc, - raw + raw, + consistency ) { function cont() { try { @@ -226,6 +227,7 @@ async function db_saveLocalPB( pb.acc = acc; pb.raw = raw; pb.timestamp = Date.now(); + pb.consistency = consistency; } }); if (!found) { @@ -237,7 +239,8 @@ async function db_saveLocalPB( wpm: wpm, acc: acc, raw: raw, - timestamp: Date.now() + timestamp: Date.now(), + consistency: consistency }); } } catch (e) { @@ -251,7 +254,8 @@ async function db_saveLocalPB( wpm: wpm, acc: acc, raw: raw, - timestamp: Date.now() + timestamp: Date.now(), + consistency: consistency }, ]; } diff --git a/public/js/script.js b/public/js/script.js index 98159b6fb..8dcb09d33 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2218,6 +2218,7 @@ function showResult(difficultyFailed = false) { stats.wpm, stats.acc, stats.wpmRaw, + stats.consistency ); } else if (e.data.resultCode === 1) { if (localPb) { From 2cbc1a0a1dcaa86e6d038c0b36f538ff1ef53212 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 12 Oct 2020 01:04:36 +0100 Subject: [PATCH 04/15] wrong var name --- public/js/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/script.js b/public/js/script.js index 8dcb09d33..ccf242ccc 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2218,7 +2218,7 @@ function showResult(difficultyFailed = false) { stats.wpm, stats.acc, stats.wpmRaw, - stats.consistency + consistency ); } else if (e.data.resultCode === 1) { if (localPb) { From 345f6436be1aa7f0a88b3849c4a0d86e2dc47876 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 12 Oct 2020 01:09:30 +0100 Subject: [PATCH 05/15] removed consolelog --- public/js/account.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/public/js/account.js b/public/js/account.js index c5fa4b78d..7681582e5 100644 --- a/public/js/account.js +++ b/public/js/account.js @@ -2142,8 +2142,6 @@ function refreshAccountPage() { thisDate.setMilliseconds(0); thisDate = thisDate.getTime(); - console.log(activityChartData); - let activityChartData_amount = []; let activityChartData_avgWpm = []; let lastTimestamp = 0; From 740a3aa78192b6ab021bd69d783542c5e5ef1b78 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 12 Oct 2020 01:12:25 +0100 Subject: [PATCH 06/15] showing pb consistency --- public/index.html | 2 ++ public/js/account.js | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/public/index.html b/public/index.html index e392498b2..35fdd4586 100644 --- a/public/index.html +++ b/public/index.html @@ -2666,6 +2666,7 @@ wpm raw accuracy + consistency @@ -2704,6 +2705,7 @@ wpm raw accuracy + consistency diff --git a/public/js/account.js b/public/js/account.js index 7681582e5..7f7233f20 100644 --- a/public/js/account.js +++ b/public/js/account.js @@ -1489,24 +1489,28 @@ function fillPbTables() { - - - + - 30 - - - + - 60 - - - + - 120 - - - + - `); $(".pageAccount .wordsPbTable tbody").html(` @@ -1515,24 +1519,28 @@ function fillPbTables() { - - - + - 25 - - - + - 50 - - - + - 100 - - - + - `); @@ -1548,6 +1556,9 @@ function fillPbTables() { ${pbData.wpm} ${pbData.raw === undefined ? "-" : pbData.raw} ${pbData.acc === undefined ? "-" : pbData.acc + "%"} + + ${pbData.consistency === undefined ? "-" : pbData.consistency + "%"} + `; } catch (e) { text += ` @@ -1555,6 +1566,7 @@ function fillPbTables() { - - - + - `; } try { @@ -1564,6 +1576,9 @@ function fillPbTables() { ${pbData.wpm} ${pbData.raw === undefined ? "-" : pbData.raw} ${pbData.acc === undefined ? "-" : pbData.acc + "%"} + + ${pbData.consistency === undefined ? "-" : pbData.consistency + "%"} + `; } catch (e) { text += ` @@ -1571,6 +1586,7 @@ function fillPbTables() { - - - + - `; } try { @@ -1580,6 +1596,9 @@ function fillPbTables() { ${pbData.wpm} ${pbData.raw === undefined ? "-" : pbData.raw} ${pbData.acc === undefined ? "-" : pbData.acc + "%"} + + ${pbData.consistency === undefined ? "-" : pbData.consistency + "%"} + `; } catch (e) { text += ` @@ -1587,6 +1606,7 @@ function fillPbTables() { - - - + - `; } try { @@ -1596,6 +1616,9 @@ function fillPbTables() { ${pbData.wpm} ${pbData.raw === undefined ? "-" : pbData.raw} ${pbData.acc === undefined ? "-" : pbData.acc + "%"} + + ${pbData.consistency === undefined ? "-" : pbData.consistency + "%"} + `; } catch (e) { text += ` @@ -1603,6 +1626,7 @@ function fillPbTables() { - - - + - `; } $(".pageAccount .timePbTable tbody").html(text); @@ -1615,6 +1639,9 @@ function fillPbTables() { ${pbData.wpm} ${pbData.raw === undefined ? "-" : pbData.raw} ${pbData.acc === undefined ? "-" : pbData.acc + "%"} + + ${pbData.consistency === undefined ? "-" : pbData.consistency + "%"} + `; } catch (e) { text += ` @@ -1622,6 +1649,7 @@ function fillPbTables() { - - - + - `; } try { @@ -1631,6 +1659,9 @@ function fillPbTables() { ${pbData.wpm} ${pbData.raw === undefined ? "-" : pbData.raw} ${pbData.acc === undefined ? "-" : pbData.acc + "%"} + + ${pbData.consistency === undefined ? "-" : pbData.consistency + "%"} + `; } catch (e) { text += ` @@ -1638,6 +1669,7 @@ function fillPbTables() { - - - + - `; } try { @@ -1647,6 +1679,9 @@ function fillPbTables() { ${pbData.wpm} ${pbData.raw === undefined ? "-" : pbData.raw} ${pbData.acc === undefined ? "-" : pbData.acc + "%"} + + ${pbData.consistency === undefined ? "-" : pbData.consistency + "%"} + `; } catch (e) { text += ` @@ -1654,6 +1689,7 @@ function fillPbTables() { - - - + - `; } try { @@ -1663,6 +1699,9 @@ function fillPbTables() { ${pbData.wpm} ${pbData.raw === undefined ? "-" : pbData.raw} ${pbData.acc === undefined ? "-" : pbData.acc + "%"} + + ${pbData.consistency === undefined ? "-" : pbData.consistency + "%"} + `; } catch (e) { text += ` @@ -1670,6 +1709,7 @@ function fillPbTables() { - - - + - `; } $(".pageAccount .wordsPbTable tbody").html(text); From 799c9cfea6996b7485347f280196846af0a274fe Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 12 Oct 2020 01:44:35 +0100 Subject: [PATCH 07/15] fixed local time not being incremented by incomplete seconds (server was still fine) --- public/js/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index ccf242ccc..889e6affb 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2018,9 +2018,9 @@ function showResult(difficultyFailed = false) { if (dbSnapshot !== null && dbSnapshot.results !== undefined) { dbSnapshot.results.unshift(completedEvent); if (dbSnapshot.globalStats.time == undefined) { - dbSnapshot.globalStats.time = testtime; + dbSnapshot.globalStats.time = testtime + completedEvent.incompleteTestSeconds; } else { - dbSnapshot.globalStats.time += testtime; + dbSnapshot.globalStats.time += testtime + completedEvent.incompleteTestSeconds; } if (dbSnapshot.globalStats.started == undefined) { dbSnapshot.globalStats.started = restartCount + 1; From 0b8265c760f0acb7c3536e6a3ef656014f096730 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 12 Oct 2020 01:58:31 +0100 Subject: [PATCH 08/15] initially generating more words to fill the space better --- public/js/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/script.js b/public/js/script.js index 889e6affb..c3d2b94ea 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -435,7 +435,7 @@ function initWords() { config.mode == "custom" ) { // let wordsBound = config.mode == "time" ? 60 : config.words; - let wordsBound = 60; + let wordsBound = 100; if (config.showAllLines) { if (config.mode === "custom") { if (customTextIsRandom) { From c6a7d934ef9b27b232345e4db3d284ce53331347 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 12 Oct 2020 23:36:17 +0100 Subject: [PATCH 09/15] removed soon --- firebase.json | 7 ----- public/soon.html | 70 ------------------------------------------------ 2 files changed, 77 deletions(-) delete mode 100644 public/soon.html diff --git a/firebase.json b/firebase.json index 0a92ba351..17e046584 100644 --- a/firebase.json +++ b/firebase.json @@ -2,13 +2,6 @@ "hosting": { "public": "public", "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], - "redirects": [ - { - "source": "/soon", - "destination": "/", - "type": 301 - } - ], "rewrites": [ { "source": "**", diff --git a/public/soon.html b/public/soon.html deleted file mode 100644 index 857683e1b..000000000 --- a/public/soon.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - Monkey Type - Coming Soon! - - - - -
- -
Coming very soon...
-
- - From eefde120671dd3ebeb7aed6f321bc1750cbfc4d1 Mon Sep 17 00:00:00 2001 From: willerbee Date: Tue, 13 Oct 2020 15:16:03 +0800 Subject: [PATCH 10/15] Added classes in menu icon buttons for targetting --- public/index.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/index.html b/public/index.html index 35fdd4586..83e285048 100644 --- a/public/index.html +++ b/public/index.html @@ -762,13 +762,13 @@
monkey-type