reduced the amount of function parameters

This commit is contained in:
Miodec 2021-06-12 19:01:49 +01:00
parent fd5a90e2d5
commit e7c93f7620

View file

@ -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) => {