mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
fix: /stats now uses double hyphens like /today for WN8
This commit is contained in:
1 parent
84056d7036
commit
843cc8e861
3 files changed
+13
-3
No files matched your search
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user