mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-22 13:36:27 +08:00
reduced the amount of function parameters
This commit is contained in:
parent
fd5a90e2d5
commit
e7c93f7620
1 changed files with 26 additions and 19 deletions
|
@ -103,19 +103,23 @@ class UsersDAO {
|
|||
|
||||
static async checkIfPb(
|
||||
uid,
|
||||
mode,
|
||||
mode2,
|
||||
acc,
|
||||
consistency,
|
||||
difficulty,
|
||||
language,
|
||||
punctuation,
|
||||
raw,
|
||||
wpm
|
||||
result
|
||||
) {
|
||||
const user = await mongoDB().collection("users").findOne({ uid });
|
||||
if (!user) throw new MonkeyError(404, "User not found");
|
||||
|
||||
const {
|
||||
mode,
|
||||
mode2,
|
||||
acc,
|
||||
consistency,
|
||||
difficulty,
|
||||
language,
|
||||
punctuation,
|
||||
raw,
|
||||
wpm
|
||||
} = result;
|
||||
|
||||
let pb = checkAndUpdatePb(
|
||||
user.personalBests,
|
||||
mode,
|
||||
|
@ -141,16 +145,7 @@ class UsersDAO {
|
|||
|
||||
static async checkIfTagPb(
|
||||
uid,
|
||||
tags,
|
||||
mode,
|
||||
mode2,
|
||||
acc,
|
||||
consistency,
|
||||
difficulty,
|
||||
language,
|
||||
punctuation,
|
||||
raw,
|
||||
wpm
|
||||
result
|
||||
) {
|
||||
const user = await mongoDB().collection("users").findOne({ uid });
|
||||
if (!user) throw new MonkeyError(404, "User not found");
|
||||
|
@ -159,6 +154,18 @@ class UsersDAO {
|
|||
return [];
|
||||
}
|
||||
|
||||
const {
|
||||
mode,
|
||||
mode2,
|
||||
acc,
|
||||
consistency,
|
||||
difficulty,
|
||||
language,
|
||||
punctuation,
|
||||
raw,
|
||||
wpm
|
||||
} = result;
|
||||
|
||||
let ret = [];
|
||||
|
||||
tags.forEach(async (tag) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue