mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 19:49:50 +01:00
feat: added "--" for NaN values
This commit is contained in:
1 parent
823465fde9
commit
0339979f9f
1 file changed
+36
-38
@@ -160,6 +160,11 @@ export default function Page() {
|
|||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const battles = diff?.list.reduce(
|
||||||
|
(accumulator, { stats }) => accumulator + stats.all.battles,
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageWrapper>
|
<PageWrapper>
|
||||||
<div className={styles.toolBar}>
|
<div className={styles.toolBar}>
|
||||||
@@ -288,12 +293,7 @@ export default function Page() {
|
|||||||
stats={[
|
stats={[
|
||||||
{
|
{
|
||||||
title: 'Battles',
|
title: 'Battles',
|
||||||
current: diff.list
|
current: battles!.toLocaleString(),
|
||||||
.reduce(
|
|
||||||
(accumulator, { stats }) => accumulator + stats.all.battles,
|
|
||||||
0,
|
|
||||||
)
|
|
||||||
.toLocaleString(),
|
|
||||||
career: tankStatsArray
|
career: tankStatsArray
|
||||||
.reduce(
|
.reduce(
|
||||||
(accumulator, stats) => accumulator + stats.all.battles,
|
(accumulator, stats) => accumulator + stats.all.battles,
|
||||||
@@ -303,18 +303,17 @@ export default function Page() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Winrate',
|
title: 'Winrate',
|
||||||
current: `${(
|
current: battles
|
||||||
100 *
|
? `${(
|
||||||
(diff.list.reduce(
|
100 *
|
||||||
(accumulator, { stats }) => accumulator + stats.all.wins,
|
(diff.list.reduce(
|
||||||
0,
|
(accumulator, { stats }) =>
|
||||||
) /
|
accumulator + stats.all.wins,
|
||||||
diff.list.reduce(
|
0,
|
||||||
(accumulator, { stats }) =>
|
) /
|
||||||
accumulator + stats.all.battles,
|
battles)
|
||||||
0,
|
).toFixed(2)}%`
|
||||||
))
|
: '--',
|
||||||
).toFixed(2)}%`,
|
|
||||||
career: `${(
|
career: `${(
|
||||||
100 *
|
100 *
|
||||||
(tankStatsArray.reduce(
|
(tankStatsArray.reduce(
|
||||||
@@ -328,40 +327,39 @@ export default function Page() {
|
|||||||
).toFixed(2)}%`,
|
).toFixed(2)}%`,
|
||||||
},
|
},
|
||||||
(() => {
|
(() => {
|
||||||
|
const battlesWithWN8 = diff.list.reduce(
|
||||||
|
(accumulator, { currentWN8, stats }) =>
|
||||||
|
(currentWN8 === undefined ? 0 : stats.all.battles) +
|
||||||
|
accumulator,
|
||||||
|
0,
|
||||||
|
);
|
||||||
const currentWN8 =
|
const currentWN8 =
|
||||||
diff.list.reduce(
|
diff.list.reduce(
|
||||||
(accumulator, { currentWN8, stats }) =>
|
(accumulator, { currentWN8, stats }) =>
|
||||||
stats.all.battles * (currentWN8 ?? 0) + accumulator,
|
stats.all.battles * (currentWN8 ?? 0) + accumulator,
|
||||||
0,
|
0,
|
||||||
) /
|
) / battlesWithWN8;
|
||||||
diff.list.reduce(
|
|
||||||
(accumulator, { currentWN8, stats }) =>
|
|
||||||
(currentWN8 === undefined ? 0 : stats.all.battles) +
|
|
||||||
accumulator,
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: 'WN8',
|
title: 'WN8',
|
||||||
current: Math.round(currentWN8).toLocaleString(),
|
current: battlesWithWN8
|
||||||
|
? Math.round(currentWN8).toLocaleString()
|
||||||
|
: '--',
|
||||||
percentile: getWN8Percentile(currentWN8),
|
percentile: getWN8Percentile(currentWN8),
|
||||||
career: Math.round(diff.careerWN8).toLocaleString(),
|
career: Math.round(diff.careerWN8).toLocaleString(),
|
||||||
};
|
};
|
||||||
})(),
|
})(),
|
||||||
{
|
{
|
||||||
title: 'Damage',
|
title: 'Damage',
|
||||||
current: Math.round(
|
current: battles
|
||||||
diff.list.reduce(
|
? Math.round(
|
||||||
(accumulator, { stats }) =>
|
diff.list.reduce(
|
||||||
accumulator + stats.all.damage_dealt,
|
(accumulator, { stats }) =>
|
||||||
0,
|
accumulator + stats.all.damage_dealt,
|
||||||
) /
|
0,
|
||||||
diff.list.reduce(
|
) / battles,
|
||||||
(accumulator, { stats }) =>
|
).toLocaleString()
|
||||||
accumulator + stats.all.battles,
|
: '--',
|
||||||
0,
|
|
||||||
),
|
|
||||||
).toLocaleString(),
|
|
||||||
career: Math.round(
|
career: Math.round(
|
||||||
tankStatsArray.reduce(
|
tankStatsArray.reduce(
|
||||||
(accumulator, stats) =>
|
(accumulator, stats) =>
|
||||||
|
|||||||
Reference in new issue
Block a user