From d0b2ac85bf4179a5a5566a5cd89772ae7cc855c3 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Thu, 4 Apr 2024 17:00:04 -0700 Subject: [PATCH] chore: debug --- plugins/fetch-scrobbles/index.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/fetch-scrobbles/index.js b/plugins/fetch-scrobbles/index.js index 61f65153..d9d6ada8 100644 --- a/plugins/fetch-scrobbles/index.js +++ b/plugins/fetch-scrobbles/index.js @@ -4,13 +4,17 @@ import fs from 'fs' const getKeys = () => { const currentDate = DateTime.now() - return [ - `${currentDate.year}-${currentDate.weekNumber}` - `${currentDate.minus({ weeks: 1 }).year}-${currentDate.minus({ weeks: 1 }).weekNumber}`, - `${currentDate.minus({ weeks: 2 }).year}-${currentDate.minus({ weeks: 2 }).weekNumber}`, - `${currentDate.minus({ weeks: 3 }).year}-${currentDate.minus({ weeks: 3 }).weekNumber}`, - `${currentDate.minus({ weeks: 4 }).year}-${currentDate.minus({ weeks: 4 }).weekNumber}`, - ] + const weeks = Math.floor(currentDate.daysInMonth / 7) + let count = 0 + const keys = [] + while (count < weeks) { + const weeks = 1 * (count + 1) + const date = DateTime.now().minus({ weeks }) + keys.push(`${date.year}-${date.weekNumber}`) + count++; + } + console.log(keys) + return keys } export const onPreBuild = async ({ constants }) => {