mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-20 07:16:17 +08:00
Require ===
and !==
in Backend (#4086) Ferotiq
* eqeqeq in backend * simplify
This commit is contained in:
parent
14da1438d9
commit
642e99331e
|
@ -91,6 +91,12 @@
|
|||
"sourceType": "module",
|
||||
"project": "**/tsconfig.json"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["backend/**/*.ts"],
|
||||
"rules": {
|
||||
"eqeqeq": "error"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -366,12 +366,8 @@ export async function addResult(
|
|||
delete result.challenge;
|
||||
}
|
||||
|
||||
let totalDurationTypedSeconds = 0;
|
||||
let afk = result.afkDuration;
|
||||
if (afk == undefined) {
|
||||
afk = 0;
|
||||
}
|
||||
totalDurationTypedSeconds =
|
||||
const afk = result.afkDuration ?? 0;
|
||||
const totalDurationTypedSeconds =
|
||||
result.testDuration + result.incompleteTestSeconds - afk;
|
||||
updateTypingStats(uid, result.restartCount, totalDurationTypedSeconds);
|
||||
PublicDAL.updateStats(result.restartCount, totalDurationTypedSeconds);
|
||||
|
|
|
@ -66,7 +66,7 @@ export async function add(
|
|||
} else {
|
||||
return { languageError: 1 };
|
||||
}
|
||||
if (duplicateId != -1) {
|
||||
if (duplicateId !== -1) {
|
||||
return { duplicateId, similarityScore };
|
||||
}
|
||||
await db.collection("new-quotes").insertOne(quote);
|
||||
|
|
|
@ -304,7 +304,7 @@ export async function removeTag(uid: string, _id: string): Promise<void> {
|
|||
const user = await getUser(uid, "remove tag");
|
||||
if (
|
||||
user.tags === undefined ||
|
||||
user.tags.filter((t) => t._id.toHexString() == _id).length === 0
|
||||
user.tags.filter((t) => t._id.toHexString() === _id).length === 0
|
||||
) {
|
||||
throw new MonkeyError(404, "Tag not found");
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ export async function removeTagPb(uid: string, _id: string): Promise<void> {
|
|||
const user = await getUser(uid, "remove tag pb");
|
||||
if (
|
||||
user.tags === undefined ||
|
||||
user.tags.filter((t) => t._id.toHexString() == _id).length === 0
|
||||
user.tags.filter((t) => t._id.toHexString() === _id).length === 0
|
||||
) {
|
||||
throw new MonkeyError(404, "Tag not found");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue