Fix division by zero

This commit is contained in:
Vilim Lendvaj 2021-05-03 23:57:24 +02:00
parent b9bac1ac7b
commit 8f65587ce3
2 changed files with 4 additions and 4 deletions

View file

@ -102,7 +102,7 @@
{numberFormat.format((banner.rare.character.length / banner.total) * 100)}%
</td>
<td class="text-rare-from font-semibold text-right border-t border-gray-700">
{rareTotal > 0 ? numberFormat.format(rarePityCharacter / banner.rare.character.length) : 0}
{banner.rare.character.length > 0 ? numberFormat.format(rarePityCharacter / banner.rare.character.length) : 0}
</td>
</tr>
<tr>
@ -116,7 +116,7 @@
{numberFormat.format((banner.rare.weapon.length / banner.total) * 100)}%
</td>
<td class="text-rare-from font-semibold text-right border-t border-gray-700">
{rareTotal > 0 ? numberFormat.format(rarePityWeapon / banner.rare.weapon.length) : 0}
{banner.rare.weapon.length > 0 ? numberFormat.format(rarePityWeapon / banner.rare.weapon.length) : 0}
</td>
</tr>
</table>

View file

@ -187,12 +187,12 @@
weapon: {
total: rareWeapon,
percentage: total > 0 ? rareWeapon / total : 0,
pity: rare > 0 ? rarePityWeapon / rareWeapon : 0,
pity: rareWeapon > 0 ? rarePityWeapon / rareWeapon : 0,
},
character: {
total: rareCharacter,
percentage: total > 0 ? rareCharacter / total : 0,
pity: rare > 0 ? rarePityCharacter / rareCharacter : 0,
pity: rareCharacter > 0 ? rarePityCharacter / rareCharacter : 0,
},
},
legendary: {