Fix error if doesn't have any 5*

pull/1/head
Made Baruna 2022-07-03 22:15:03 +07:00
parent e213abb4ed
commit 05a9fa4559
2 changed files with 10 additions and 7 deletions

View File

@ -202,6 +202,8 @@
function change(type) { function change(type) {
current = type; current = type;
disableWinRateOff = false;
getData(); getData();
getDataLuckAll(); getDataLuckAll();
} }

View File

@ -213,11 +213,17 @@
}; };
if (counterData.rateoff !== undefined) { if (counterData.rateoff !== undefined) {
percentages[type.id] = {
winRateOff: {},
};
if (avg[type.id].rare.total > 0) { if (avg[type.id].rare.total > 0) {
avg[type.id].rare.rateOff = { avg[type.id].rare.rateOff = {
total: counterData.rateoff.rare.win, total: counterData.rateoff.rare.win,
percentage: counterData.rateoff.rare.win / (counterData.rateoff.rare.win + counterData.rateoff.rare.lose), 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) { if (avg[type.id].legendary.total > 0) {
avg[type.id].legendary.rateOff = { avg[type.id].legendary.rateOff = {
@ -226,14 +232,9 @@
counterData.rateoff.legendary.win / counterData.rateoff.legendary.win /
(counterData.rateoff.legendary.win + counterData.rateoff.legendary.lose), (counterData.rateoff.legendary.win + counterData.rateoff.legendary.lose),
}; };
}
percentages[type.id] = { percentages[type.id].winRateOff.legendary = avg[type.id].legendary.rateOff.percentage;
winRateOff: { }
legendary: avg[type.id].legendary.rateOff.percentage,
rare: avg[type.id].rare.rateOff.percentage,
},
};
} }
percentages[type.id] = { percentages[type.id] = {