From ae300bfa94684a44c9bddb747d2424cadda22d90 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 20 Jun 2022 15:06:35 +0200 Subject: [PATCH] Disabled time typing requirement on dev (#3169) * checking if mode is dev when adding to daily lb * disabled time typing check on dev when recalculating leaderboards * not replacing footer on localhost * using ternary * modified logic --- backend/src/api/controllers/result.ts | 2 +- backend/src/dal/leaderboards.ts | 4 +++- frontend/src/ts/elements/leaderboards.ts | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/src/api/controllers/result.ts b/backend/src/api/controllers/result.ts index b6fc4bf4d..5f32af2c0 100644 --- a/backend/src/api/controllers/result.ts +++ b/backend/src/api/controllers/result.ts @@ -327,7 +327,7 @@ export async function addResult( (funbox === "none" || funbox === "plus_one" || funbox === "plus_two") && !bailedOut && !user.banned && - (user.timeTyping ?? 0) > 7200; + (process.env.MODE === "dev" || (user.timeTyping ?? 0) > 7200); if (dailyLeaderboard && validResultCriteria) { incrementDailyLeaderboard(result.mode, result.mode2, result.language); diff --git a/backend/src/dal/leaderboards.ts b/backend/src/dal/leaderboards.ts index 95eddf6a3..45d011c87 100644 --- a/backend/src/dal/leaderboards.ts +++ b/backend/src/dal/leaderboards.ts @@ -78,7 +78,9 @@ export async function update( $exists: true, }, banned: { $exists: false }, - timeTyping: { $gt: 7200 }, + timeTyping: { + $gt: process.env.MODE === "dev" ? 0 : 7200, + }, }, }, { diff --git a/frontend/src/ts/elements/leaderboards.ts b/frontend/src/ts/elements/leaderboards.ts index 948ccdf07..4d3e903bf 100644 --- a/frontend/src/ts/elements/leaderboards.ts +++ b/frontend/src/ts/elements/leaderboards.ts @@ -133,7 +133,10 @@ function updateFooter(lb: LbKey): void { return; } - if ((DB.getSnapshot().globalStats?.time ?? 0) < 7200) { + if ( + window.location.hostname !== "localhost" && + (DB.getSnapshot().globalStats?.time ?? 0) < 7200 + ) { $(`#leaderboardsWrapper table.${side} tfoot`).html(` Your account must have 2 hours typed to be placed on the leaderboard.