Fix chart error

This commit is contained in:
Made Baruna 2021-03-30 16:40:18 +08:00
parent 922f83d557
commit 41a1d2fdaf
2 changed files with 32 additions and 24 deletions

View file

@ -104,6 +104,7 @@ export function process(id) {
const nextBanner = getNextBanner(pull.time, currentBannerIndex, selectedBanners);
if (nextBanner === undefined) {
console.log('error banner here', JSON.stringify(pull));
pushToast(t('wish.errorBanner'), 'error');
return null;
}

View file

@ -41,6 +41,8 @@
beginners: 'beginners',
};
let errorProcessingPull = '';
const bannerType = bannerTypes[id];
let bannerChart;
let pieChart;
@ -138,6 +140,8 @@
currentBanner = getNextBanner(pull.time);
if (currentBanner === undefined) {
console.log('error banner here', JSON.stringify(pull));
errorProcessingPull = JSON.stringify(pull);
pushToast($t('wish.errorBanner'), 'error');
return;
}
@ -234,7 +238,6 @@
await tick();
setTimeout(() => {
new Chart(pieChart, {
type: 'pie',
data: {
@ -260,6 +263,7 @@
},
});
if (id === 'character-event' || id === 'weapon-event') {
new Chart(bannerChart, {
type: 'bar',
data: {
@ -319,7 +323,7 @@
},
},
});
}, 500);
}
}
function sortPulls() {
@ -403,6 +407,9 @@
</div>
{#if loading}
<div class="text-white pl-4 md:pl-8 mt-4">{$t('wish.detail.loading')}</div>
{#if errorProcessingPull !== ''}
Error when getting banner for {errorProcessingPull}
{/if}
{:else}
<div class="flex mt-4 wrapper">
<div class="block overflow-x-auto xl:overflow-x-visible whitespace-no-wrap px">