From 8bb52e3318c92ed0e296757becc210bcf61e3c6d Mon Sep 17 00:00:00 2001 From: mat-1 Date: Mon, 1 Mar 2021 19:48:53 +0000 Subject: Compiled TS into JS --- build/database.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'build/database.js') diff --git a/build/database.js b/build/database.js index fdcc01b..f9f3509 100644 --- a/build/database.js +++ b/build/database.js @@ -41,7 +41,8 @@ const recentlyUpdated = new node_cache_1.default({ const cachedRawLeaderboards = new Map(); const leaderboardMax = 100; const reversedStats = [ - 'first_join' + 'first_join', + '_best_time', '_best_time_2' ]; let client; let database; @@ -107,7 +108,15 @@ async function fetchAllMemberLeaderboardAttributes() { } exports.fetchAllMemberLeaderboardAttributes = fetchAllMemberLeaderboardAttributes; function isLeaderboardReversed(name) { - return reversedStats.includes(name); + for (const statMatch of reversedStats) { + let trailingEnd = statMatch[0] === '_'; + let trailingStart = statMatch.substr(-1) === '_'; + if ((trailingStart && name.startsWith(statMatch)) + || (trailingEnd && name.endsWith(statMatch)) + || (name == statMatch)) + return true; + } + return false; } async function fetchMemberLeaderboardRaw(name) { if (cachedRawLeaderboards.has(name)) -- cgit