feat: no battles in period

This commit is contained in:
TresAbhi committed 2023-05-13 17:50:03 +00:00
1 parent 75fab881fd
commit d62ca080e9
1 file changed
+81 -72
+81 -72
View File
@@ -129,78 +129,87 @@ export default {
} stats`, } stats`,
) )
.setDescription( .setDescription(
`${ stats.all.battles > 0
period === 'today' ? `${
? '**⚠ "Today" stats are in development. Some stats are not available/wrong.**\n\n' period === 'today'
: '' ? '**⚠ "Today" stats are in development. Some stats are not available/wrong.**\n\n'
}${[ : ''
[ }${[
'Winrate', [
`${(100 * (stats.all.wins / stats.all.battles)).toFixed(2)}%`, 'Winrate',
], `${(100 * (stats.all.wins / stats.all.battles)).toFixed(
[ 2,
'Survival', )}%`,
`${( ],
100 * [
(stats.all.survived_battles / stats.all.battles) 'Survival',
).toFixed(2)}%`, `${(
], 100 *
[ (stats.all.survived_battles / stats.all.battles)
'Accuracy', ).toFixed(2)}%`,
`${((stats.all.hits / stats.all.shots) * 100).toFixed(2)}%`, ],
], [
['WN8', stats.wn8.toFixed(0)], 'Accuracy',
['WN7', stats.wn7.toFixed(0)], `${((stats.all.hits / stats.all.shots) * 100).toFixed(
[], 2,
['Battles', stats.all.battles], )}%`,
['Wins', stats.all.wins], ],
['Losses', stats.all.losses], ['WN8', stats.wn8.toFixed(0)],
['Average tier', stats.avg_tier.toFixed(2)], ['WN7', stats.wn7.toFixed(0)],
[], [],
[ ['Battles', stats.all.battles],
'Shots per battle', ['Wins', stats.all.wins],
(stats.all.shots / stats.all.battles).toFixed(2), ['Losses', stats.all.losses],
], ['Average tier', stats.avg_tier.toFixed(2)],
[ [],
'Hits per battle', [
(stats.all.hits / stats.all.battles).toFixed(2), 'Shots per battle',
], (stats.all.shots / stats.all.battles).toFixed(2),
[ ],
'Damage per battle', [
(stats.all.damage_dealt / stats.all.battles).toFixed(0), 'Hits per battle',
], (stats.all.hits / stats.all.battles).toFixed(2),
[ ],
'Kills per battle', [
(stats.all.frags / stats.all.battles).toFixed(2), 'Damage per battle',
], (stats.all.damage_dealt / stats.all.battles).toFixed(0),
[ ],
'Spots per battle', [
(stats.all.spotted / stats.all.battles).toFixed(2), 'Kills per battle',
], (stats.all.frags / stats.all.battles).toFixed(2),
[ ],
'XP per battle', [
(stats.all.xp / stats.all.battles).toFixed(0), 'Spots per battle',
], (stats.all.spotted / stats.all.battles).toFixed(2),
[], ],
[ [
'Damage ratio', 'XP per battle',
(stats.all.damage_dealt / stats.all.damage_received).toFixed( (stats.all.xp / stats.all.battles).toFixed(0),
2, ],
), [],
], [
[ 'Damage ratio',
'Kills to death ratio', (
( stats.all.damage_dealt / stats.all.damage_received
stats.all.frags / ).toFixed(2),
(stats.all.battles - stats.all.survived_battles) ],
).toFixed(2), [
], 'Kills to death ratio',
] (
.filter((array) => array[1] !== `${-Infinity}`) stats.all.frags /
.map((array) => (stats.all.battles - stats.all.survived_battles)
array.length === 0 ? '' : `**${array[0]}**: ${array[1]}`, ).toFixed(2),
) ],
.join('\n')}\n\n${blitzLinks(server, blitzAccount.nickname)}`, ]
.filter((array) => array[1] !== `${-Infinity}`)
.map((array) =>
array.length === 0 ? '' : `**${array[0]}**: ${array[1]}`,
)
.join('\n')}\n\n${blitzLinks(
server,
blitzAccount.nickname,
)}`
: 'No battles played in this period.',
), ),
), ),
], ],