aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat-1 <github@matdoes.dev>2021-03-01 19:48:53 +0000
committermat-1 <github@matdoes.dev>2021-03-01 19:48:53 +0000
commit8bb52e3318c92ed0e296757becc210bcf61e3c6d (patch)
tree465e0b641a03b1902f71af05f70cd54a52b36d12
parent40e9f8f0a90cc784e266c9a1c8f2da1de90107ea (diff)
downloadskyblock-api-8bb52e3318c92ed0e296757becc210bcf61e3c6d.tar.gz
skyblock-api-8bb52e3318c92ed0e296757becc210bcf61e3c6d.tar.bz2
skyblock-api-8bb52e3318c92ed0e296757becc210bcf61e3c6d.zip
Compiled TS into JS
-rw-r--r--build/database.js13
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))