From 18a75dfca706bc314409100ed8e2d829f3cf57cd Mon Sep 17 00:00:00 2001 From: Made Baruna Date: Sun, 28 Mar 2021 00:18:44 +0800 Subject: [PATCH] Adjust function return data --- src/functions/export.js | 11 +++++------ src/functions/wish.js | 10 ++++------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/functions/export.js b/src/functions/export.js index 9b4a3c05..2827d1d7 100644 --- a/src/functions/export.js +++ b/src/functions/export.js @@ -1,7 +1,6 @@ import { Workbook } from 'exceljs'; import dayjs from 'dayjs'; -import { bannerTypes } from '../data/bannerTypes'; import { banners } from '../data/banners'; import { getTimeOffset } from '../stores/server'; @@ -129,8 +128,7 @@ async function addInformation(workbook) { */ async function addWishHistory(workbook, icons) { for (const [id, category] of Object.entries(bannerCategories)) { - const data = process(id); - + const sheet = workbook.getWorksheet(category); sheet.columns = [ { header: 'Type', width: 9 }, @@ -143,17 +141,18 @@ async function addWishHistory(workbook, icons) { { header: 'Banner', width: 24 }, { header: 'Icon', width: 5.5 }, ]; - + sheet.getRow(1).font = { bold: true, }; - + + const data = process(id); if (data === null) continue; let groupCount = 0; let lastTime = 0; let lastBanner = ''; - for (const pull of data) { + for (const pull of data.pulls) { if (lastBanner !== pull.banner.image) { groupCount = 0; } diff --git a/src/functions/wish.js b/src/functions/wish.js index f2a1f8bf..1353fc47 100644 --- a/src/functions/wish.js +++ b/src/functions/wish.js @@ -160,10 +160,8 @@ export function process(id) { currentPulls.push(newPull); } - return currentPulls; - - // console.log(JSON.stringify(pulls.slice(0, 5).map(e => [e.time.toString(), e.id, e.type, e.pity, e.group === 'group']))); - // console.log(JSON.stringify(selectedBanners[8].legendary.map(e => [e.time.toString(), e.id, e.type, e.pity, e.group === 'group']))); - // console.log(JSON.stringify(selectedBanners[8].rarePity)); - // console.log(selectedBanners[8].legendary.length, selectedBanners[8].rare.character.length + selectedBanners[8].rare.weapon.length, selectedBanners[8].total); + return { + pulls: currentPulls, + banner: selectedBanners, + } }