Update excel export if banner time mismatch

pull/1/head
Made Baruna 2021-12-23 23:39:16 +07:00
parent 09fe4afa2e
commit 7a4b0412c2
No known key found for this signature in database
GPG Key ID: 5AA5DA16AA5DCEAD
2 changed files with 18 additions and 8 deletions

View File

@ -100,6 +100,8 @@ export async function process(id) {
let startBanner = false; let startBanner = false;
let currentBannerIndex = -1; let currentBannerIndex = -1;
let hasManualInput = false; let hasManualInput = false;
let lastBanner;
let lastBannerIndex;
let pity = 0; let pity = 0;
for (let i = 0; i < pullData.length; i++) { for (let i = 0; i < pullData.length; i++) {
@ -108,18 +110,22 @@ export async function process(id) {
const currentPullTime = dayjs(pull.time).unix(); const currentPullTime = dayjs(pull.time).unix();
if (currentBanner === null || currentBanner.end < currentPullTime) { if (currentBanner === null || currentBanner.end < currentPullTime) {
lastBannerIndex = currentBannerIndex;
const nextBanner = getNextBanner(currentPullTime, currentBannerIndex, selectedBanners); const nextBanner = getNextBanner(currentPullTime, currentBannerIndex, selectedBanners);
if (nextBanner === undefined) { if (nextBanner === undefined) {
console.log('error banner here', JSON.stringify(pull)); console.log('error banner here', JSON.stringify(pull));
pushToast(t('wish.errorBanner'), 'error'); pushToast(t('wish.errorBanner'), 'error');
return null; currentBannerIndex = lastBannerIndex;
currentBanner = lastBanner;
} else {
currentBanner = nextBanner.selectedBanner;
currentBannerIndex = nextBanner.currentBannerIndex;
lastBanner = currentBanner;
startBanner = true;
} }
currentBanner = nextBanner.selectedBanner;
currentBannerIndex = nextBanner.currentBannerIndex;
startBanner = true;
if (i > 0) { if (i > 0) {
currentPulls[i - 1].end = true; currentPulls[i - 1].end = true;
} }

View File

@ -156,6 +156,7 @@
let startBanner = false; let startBanner = false;
let rateUp = false; let rateUp = false;
let lastBanner; let lastBanner;
let lastBannerIndex;
for (let i = 0; i < pullData.length; i++) { for (let i = 0; i < pullData.length; i++) {
const pull = pullData[i]; const pull = pullData[i];
@ -163,19 +164,22 @@
const currentPullTime = dayjs(pull.time).unix(); const currentPullTime = dayjs(pull.time).unix();
if (currentBanner === null || currentBanner.end < currentPullTime) { if (currentBanner === null || currentBanner.end < currentPullTime) {
lastBannerIndex = currentBannerIndex;
currentBanner = getNextBanner(currentPullTime); currentBanner = getNextBanner(currentPullTime);
if (currentBanner === undefined) { if (currentBanner === undefined) {
// console.log('error banner here', JSON.stringify(pull)); console.log('error banner here', JSON.stringify(pull));
// errorProcessingPull = pull; // errorProcessingPull = pull;
// pushToast($t('wish.errorBanner'), 'error'); // pushToast($t('wish.errorBanner'), 'error');
// return; // return;
currentBannerIndex = lastBannerIndex;
currentBanner = lastBanner; currentBanner = lastBanner;
} else {
startBanner = true;
} }
lastBanner = currentBanner; lastBanner = currentBanner;
startBanner = true;
if (i > 0) { if (i > 0) {
currentPulls[i - 1].end = true; currentPulls[i - 1].end = true;