From 05a9fa4559b6017e0b268673258fd6c7dafb25ee Mon Sep 17 00:00:00 2001 From: Made Baruna Date: Sun, 3 Jul 2022 22:15:03 +0700 Subject: [PATCH] Fix error if doesn't have any 5* --- src/routes/wish/_rank.svelte | 2 ++ src/routes/wish/_summary.svelte | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/routes/wish/_rank.svelte b/src/routes/wish/_rank.svelte index 9b569656..623fc843 100644 --- a/src/routes/wish/_rank.svelte +++ b/src/routes/wish/_rank.svelte @@ -202,6 +202,8 @@ function change(type) { current = type; + disableWinRateOff = false; + getData(); getDataLuckAll(); } diff --git a/src/routes/wish/_summary.svelte b/src/routes/wish/_summary.svelte index de033a37..6d855d00 100644 --- a/src/routes/wish/_summary.svelte +++ b/src/routes/wish/_summary.svelte @@ -213,11 +213,17 @@ }; if (counterData.rateoff !== undefined) { + percentages[type.id] = { + winRateOff: {}, + }; + if (avg[type.id].rare.total > 0) { avg[type.id].rare.rateOff = { total: counterData.rateoff.rare.win, percentage: counterData.rateoff.rare.win / (counterData.rateoff.rare.win + counterData.rateoff.rare.lose), }; + + percentages[type.id].winRateOff.rare = avg[type.id].rare.rateOff.percentage; } if (avg[type.id].legendary.total > 0) { avg[type.id].legendary.rateOff = { @@ -226,14 +232,9 @@ counterData.rateoff.legendary.win / (counterData.rateoff.legendary.win + counterData.rateoff.legendary.lose), }; - } - percentages[type.id] = { - winRateOff: { - legendary: avg[type.id].legendary.rateOff.percentage, - rare: avg[type.id].rare.rateOff.percentage, - }, - }; + percentages[type.id].winRateOff.legendary = avg[type.id].legendary.rateOff.percentage; + } } percentages[type.id] = {