fix: all commands now work with a lack of tankopedia entries

This commit is contained in:
TresAbhi committed 2023-07-07 01:08:00 +00:00
1 parent f907c79d68
commit ca208e44a1
12 files changed
+59 -26

No files matched your search

+17 -2
View File
@@ -71,12 +71,27 @@ export const eligibleCommand: CommandRegistry = {
(await entries.reduce<PossiblyPromise<number>>(
async (accumulator, [tankIdString, stats]) => {
const tankId = parseInt(tankIdString);
const tankTier = (await tankopedia)[tankId].tier;
const tankopediaEntry = (await tankopedia)[tankId];
if (!tankopediaEntry) return accumulator;
const tankTier = tankopediaEntry.tier;
return (await accumulator) + tankTier * stats.battles;
},
0,
)) / stats.battles;
)) /
(await entries.reduce<PossiblyPromise<number>>(
async (accumulator, [tankIdString, stats]) => {
const tankId = parseInt(tankIdString);
const tankopediaEntry = (await tankopedia)[tankId];
if (!tankopediaEntry) return accumulator;
return stats.battles;
},
0,
));
const WN8 =
(await entries.reduce<PossiblyPromise<number>>(
async (accumulator, [tankIdString, stats]) => {