feat: updated full stats

This commit is contained in:
TrèsAbhi committed 2023-10-11 18:57:51 -05:00
1 parent d2668974f7
commit d062a0da1b
7 files changed
+99 -246

No files matched your search

+1 -1
View File
@@ -75,5 +75,5 @@ export async function filterStats(
) / battlesOfTanksWithTankopediaEntry,
};
return { stats, supplementary };
return { stats, supplementary, filteredOrder };
}
+1 -1
View File
@@ -9,7 +9,7 @@ export interface TankopediaEntry {
nation: string;
is_premium: boolean;
is_collectible: boolean;
tier: number;
tier: Tier;
cost: { price_credit: number; price_gold: number };
images: { preview: string; normal: string };
tank_id: number;
+22
View File
@@ -0,0 +1,22 @@
import { TierWeightsRecord } from '../../components/TierWeights';
import { AllStats } from '../../types/accountInfo';
import { tankopedia } from '../blitz/tankopedia';
export async function getTierWeights(
stats: Record<number, AllStats>,
order: number[] = Object.keys(stats).map(parseInt),
) {
const awaitedTankopedia = await tankopedia;
const tierWeights: TierWeightsRecord = {};
order.map((id) => {
const entry = awaitedTankopedia[id];
if (!entry) return;
if (!tierWeights[entry.tier]) tierWeights[entry.tier] = 0;
tierWeights[entry.tier]! += stats[id].battles;
});
return tierWeights;
}