diff options
Diffstat (limited to 'build')
-rw-r--r-- | build/database.js | 13 |
1 files changed, 11 insertions, 2 deletions
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)) |