mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +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,
|
0,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let hasWN8AccumulatedAtAll = false;
|
||||||
|
|
||||||
supplementaryStats = {
|
supplementaryStats = {
|
||||||
tier:
|
tier:
|
||||||
entries.reduce((accumulator, [tankIdString, stats]) => {
|
entries.reduce((accumulator, [tankIdString, stats]) => {
|
||||||
@@ -93,11 +95,14 @@ export default {
|
|||||||
// edge case where new tanks don't have averages
|
// edge case where new tanks don't have averages
|
||||||
if (tankAverages[tankId]) {
|
if (tankAverages[tankId]) {
|
||||||
const tankWN8 = getWN8(tankAverages[tankId].all, stats);
|
const tankWN8 = getWN8(tankAverages[tankId].all, stats);
|
||||||
|
hasWN8AccumulatedAtAll = true;
|
||||||
return accumulator + tankWN8 * stats.battles;
|
return accumulator + tankWN8 * stats.battles;
|
||||||
} else return accumulator;
|
} else return accumulator;
|
||||||
}, 0) / totalBattles,
|
}, 0) / totalBattles,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!hasWN8AccumulatedAtAll) supplementaryStats.WN8 = undefined;
|
||||||
|
|
||||||
stats = sumStats(entries.map(([, stats]) => stats));
|
stats = sumStats(entries.map(([, stats]) => stats));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,10 +17,14 @@ export default function GenericAllStats({
|
|||||||
['Winrate', `${(100 * (stats.wins / stats.battles)).toFixed(2)}%`],
|
['Winrate', `${(100 * (stats.wins / stats.battles)).toFixed(2)}%`],
|
||||||
[
|
[
|
||||||
'WN8',
|
'WN8',
|
||||||
supplementaryStats?.WN8.toFixed(0),
|
|
||||||
supplementaryStats
|
supplementaryStats
|
||||||
? getWN8Percentile(supplementaryStats.WN8)
|
? supplementaryStats.WN8 === undefined
|
||||||
|
? '--'
|
||||||
|
: supplementaryStats.WN8.toFixed(0)
|
||||||
: undefined,
|
: undefined,
|
||||||
|
supplementaryStats?.WN8 === undefined
|
||||||
|
? undefined
|
||||||
|
: getWN8Percentile(supplementaryStats.WN8),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'Survival',
|
'Survival',
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ export interface AllStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface SupplementaryStats {
|
export interface SupplementaryStats {
|
||||||
WN8: number;
|
// if undefined, WN8 is not available for tanks without averages
|
||||||
|
WN8?: number;
|
||||||
tier: number;
|
tier: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user