mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-12 23:20:25 +08:00
added comment
This commit is contained in:
parent
032621a0d8
commit
c3b058c836
1 changed files with 9 additions and 19 deletions
|
@ -1,32 +1,22 @@
|
|||
const MonkeyError = require("../handlers/error");
|
||||
// const MonkeyError = require("../handlers/error");
|
||||
const { mongoDB } = require("../init/mongodb");
|
||||
const { roundTo2 } = require("../handlers/misc");
|
||||
|
||||
class PublicStatsDAO {
|
||||
|
||||
static async increment(started, completed, time){
|
||||
//needs to be rewritten, this is public stats not user stats
|
||||
static async increment(started, completed, time) {
|
||||
time = roundTo2(time);
|
||||
await mongoDB()
|
||||
.collection("users")
|
||||
.updateOne(
|
||||
{ name: 'startedTests' },
|
||||
{ $inc: { value: started } }
|
||||
);
|
||||
.collection("users")
|
||||
.updateOne({ name: "startedTests" }, { $inc: { value: started } });
|
||||
await mongoDB()
|
||||
.collection("users")
|
||||
.updateOne(
|
||||
{ name: 'completedTests' },
|
||||
{ $inc: { value: completed } }
|
||||
);
|
||||
.collection("users")
|
||||
.updateOne({ name: "completedTests" }, { $inc: { value: completed } });
|
||||
await mongoDB()
|
||||
.collection("users")
|
||||
.updateOne(
|
||||
{ name: 'timeTyping' },
|
||||
{ $inc: { value: time } }
|
||||
);
|
||||
.collection("users")
|
||||
.updateOne({ name: "timeTyping" }, { $inc: { value: time } });
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = PublicStatsDAO;
|
||||
|
|
Loading…
Reference in a new issue