diff --git a/src/components/WishImportModal.svelte b/src/components/WishImportModal.svelte index 3718ff7a..5f751801 100644 --- a/src/components/WishImportModal.svelte +++ b/src/components/WishImportModal.svelte @@ -73,6 +73,11 @@ let currentBanner = ''; let currentPage = 1; + let lastPull = { + id: '0', + time: 0, + } + function cancel() { fetchController.abort(); cancelled = true; @@ -222,6 +227,11 @@ const name = row.name; const type = row.item_type.replace(/ /g, ''); + if (row.id > lastPull.id) { + lastPull.id = row.id; + lastPull.time = time.format(); + } + if (time.unix() <= newestPullTime) { return; } @@ -257,6 +267,7 @@ } catch (err) { processingLog = false; pushToast($t('wish.import.invalidData'), 'error'); + console.error(err); throw 'invalid data'; } } while (result.length > 0 && lastTime > newestPullTime); @@ -391,7 +402,7 @@ pushToast($t('wish.import.success')); if (wishTallyChecked) { - submitWishTally(); + submitWishTally(lastPull); } closeModal(); diff --git a/src/functions/wishTally.js b/src/functions/wishTally.js index 3d337381..eb1ca07c 100644 --- a/src/functions/wishTally.js +++ b/src/functions/wishTally.js @@ -14,7 +14,7 @@ async function sendWish(data) { } } -export async function submitWishTally() { +export async function submitWishTally(lastPull) { let prefixId = 0; for (const id of bannerCategories) { prefixId += 100000; @@ -64,6 +64,7 @@ export async function submitWishTally() { total, legendary: legendaryCount, rare: rareCount, + lastPull, }); } }