fix: edge case; new tanks don't have averages

This commit is contained in:
TresAbhi committed 2023-06-03 00:38:57 +00:00
1 parent 132817dbe0
commit bf9f3ce20e
1 file changed
+5 -2
+5 -2
View File
@@ -88,9 +88,12 @@ export default {
WN8:
entries.reduce((accumulator, [tankIdString, stats]) => {
const tankId = Number(tankIdString);
const tankWN8 = getWN8(tankAverages[tankId].all, stats);
return accumulator + tankWN8 * stats.battles;
// edge case where new tanks don't have averages
if (tankAverages[tankId]) {
const tankWN8 = getWN8(tankAverages[tankId].all, stats);
return accumulator + tankWN8 * stats.battles;
} else return accumulator;
}, 0) / totalBattles,
};