From 95b105cb65e36634d2b348ad483d1c8df02fb662 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Wed, 5 Jul 2023 01:28:59 +0000 Subject: [PATCH] fix: stats now handles unowned tanks --- src/commands/evolution.tsx | 2 +- src/commands/stats.tsx | 2 +- src/renderers/stats.tsx | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/commands/evolution.tsx b/src/commands/evolution.tsx index 25e7274dc..2e467e769 100644 --- a/src/commands/evolution.tsx +++ b/src/commands/evolution.tsx @@ -20,7 +20,7 @@ import { AccountInfo } from '../types/accountInfo.js'; export const evolutionCommand: CommandRegistry = { inProduction: true, - inDevelopment: false, + inDevelopment: true, inPublic: true, command: addStatTypeSubCommandGroups( diff --git a/src/commands/stats.tsx b/src/commands/stats.tsx index e7b4d47a8..45702853b 100644 --- a/src/commands/stats.tsx +++ b/src/commands/stats.tsx @@ -20,7 +20,7 @@ import { AccountInfo } from '../types/accountInfo.js'; export const statsCommand: CommandRegistry = { inProduction: true, - inDevelopment: false, + inDevelopment: true, inPublic: true, command: addStatTypeSubCommandGroups( diff --git a/src/renderers/stats.tsx b/src/renderers/stats.tsx index bbcfb9629..b11137e8d 100644 --- a/src/renderers/stats.tsx +++ b/src/renderers/stats.tsx @@ -52,7 +52,7 @@ export default async function stats( } const tankStats = await getTankStatsDiffed(server, id, start, end); - let stats: AllStats; + let stats: AllStats | undefined; let supplementaryStats: SupplementaryStats; let tierWeights: TierWeightsRecord; @@ -117,7 +117,9 @@ export default async function stats( stats = tankStats[tankId!]; supplementaryStats = { - WN8: calculateWN8(tankAverages[tankId!].all, tankStats[tankId!]), + WN8: stats + ? calculateWN8(tankAverages[tankId!].all, tankStats[tankId!]) + : undefined, tier: tankopedia[tankId!].tier, }; } @@ -154,8 +156,8 @@ export default async function stats( }`} /> - {stats.battles === 0 && } - {stats.battles > 0 && overview} + {!stats?.battles && } + {stats?.battles > 0 && overview}