mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-28 21:19:52 +01:00
fix: Infinity and NaN values in GenericAllStats now render as --
This commit is contained in:
1 parent
e0c1db2a0b
commit
0cf0e63fda
1 file changed
+6
-5
@@ -11,6 +11,10 @@ export default function GenericAllStats({
|
|||||||
stats,
|
stats,
|
||||||
supplementaryStats,
|
supplementaryStats,
|
||||||
}: GenericAllStatsProps) {
|
}: GenericAllStatsProps) {
|
||||||
|
const damageRatio = stats.damage_dealt / stats.damage_received;
|
||||||
|
const killsToDeathRatio =
|
||||||
|
stats.frags / (stats.battles - stats.survived_battles);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GenericStats
|
<GenericStats
|
||||||
stats={[
|
stats={[
|
||||||
@@ -41,13 +45,10 @@ export default function GenericAllStats({
|
|||||||
['Average hits', (stats.hits / stats.battles).toFixed(2)],
|
['Average hits', (stats.hits / stats.battles).toFixed(2)],
|
||||||
['Average kills', (stats.frags / stats.battles).toFixed(2)],
|
['Average kills', (stats.frags / stats.battles).toFixed(2)],
|
||||||
['Average spots', (stats.spotted / stats.battles).toFixed(2)],
|
['Average spots', (stats.spotted / stats.battles).toFixed(2)],
|
||||||
[
|
['Damage ratio', isFinite(damageRatio) ? damageRatio.toFixed(2) : '--'],
|
||||||
'Damage ratio',
|
|
||||||
(stats.damage_dealt / stats.damage_received).toFixed(2),
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'Kills to death ratio',
|
'Kills to death ratio',
|
||||||
(stats.frags / (stats.battles - stats.survived_battles)).toFixed(2),
|
isFinite(killsToDeathRatio) ? killsToDeathRatio.toFixed(2) : '--',
|
||||||
],
|
],
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in new issue
Block a user