diff --git a/src/commands/stats.tsx b/src/commands/stats.tsx index 87d744228..20f36d380 100644 --- a/src/commands/stats.tsx +++ b/src/commands/stats.tsx @@ -78,6 +78,8 @@ export default { 0, ); + let hasWN8AccumulatedAtAll = false; + supplementaryStats = { tier: entries.reduce((accumulator, [tankIdString, stats]) => { @@ -93,11 +95,14 @@ export default { // edge case where new tanks don't have averages if (tankAverages[tankId]) { const tankWN8 = getWN8(tankAverages[tankId].all, stats); + hasWN8AccumulatedAtAll = true; return accumulator + tankWN8 * stats.battles; } else return accumulator; }, 0) / totalBattles, }; + if (!hasWN8AccumulatedAtAll) supplementaryStats.WN8 = undefined; + stats = sumStats(entries.map(([, stats]) => stats)); } diff --git a/src/components/GenericAllStats.tsx b/src/components/GenericAllStats.tsx index 7388aa7fa..c919ab223 100644 --- a/src/components/GenericAllStats.tsx +++ b/src/components/GenericAllStats.tsx @@ -17,10 +17,14 @@ export default function GenericAllStats({ ['Winrate', `${(100 * (stats.wins / stats.battles)).toFixed(2)}%`], [ 'WN8', - supplementaryStats?.WN8.toFixed(0), supplementaryStats - ? getWN8Percentile(supplementaryStats.WN8) + ? supplementaryStats.WN8 === undefined + ? '--' + : supplementaryStats.WN8.toFixed(0) : undefined, + supplementaryStats?.WN8 === undefined + ? undefined + : getWN8Percentile(supplementaryStats.WN8), ], [ 'Survival', diff --git a/src/types/accountInfo.ts b/src/types/accountInfo.ts index 908930892..eae1a94d6 100644 --- a/src/types/accountInfo.ts +++ b/src/types/accountInfo.ts @@ -19,7 +19,8 @@ export interface AllStats { } export interface SupplementaryStats { - WN8: number; + // if undefined, WN8 is not available for tanks without averages + WN8?: number; tier: number; }