From f40a49afafcc251e2d80e3eaf188def4e9b15e9b Mon Sep 17 00:00:00 2001 From: Ross Brodbeck Date: Tue, 26 May 2020 10:25:39 -0400 Subject: [PATCH] fix retro logic and add logging --- dist/index.js | 6 +++++- src/retro.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 9dc9ad1..8eca0a6 100644 --- a/dist/index.js +++ b/dist/index.js @@ -7433,8 +7433,12 @@ function whoIsNext(handles, retroCadenceInWeeks) { const today = new Date(); const diff = today.getTime() - firstWeek.getTime(); const daysSince = Math.floor(diff / (1000 * 60 * 60 * 24)); + core.info(`Days since: ${daysSince}`); const retrosSince = Math.floor(daysSince / (7 * retroCadenceInWeeks)); - const index = Math.ceil((retrosSince / 2) % handles.length); + core.info(`Retros since: ${retrosSince}`); + core.info(`List of handles length: ${handles.length}`); + const index = Math.floor(retrosSince % handles.length); + core.info(`Handle index: ${index}`); const nxt = handles[index]; return nxt; } diff --git a/src/retro.ts b/src/retro.ts index 3d74825..b208b03 100644 --- a/src/retro.ts +++ b/src/retro.ts @@ -63,8 +63,12 @@ function whoIsNext(handles: string[], retroCadenceInWeeks: number): string { const today = new Date() const diff = today.getTime() - firstWeek.getTime() const daysSince = Math.floor(diff / (1000 * 60 * 60 * 24)) + core.info(`Days since: ${daysSince}`) const retrosSince = Math.floor(daysSince / (7 * retroCadenceInWeeks)) - const index = Math.ceil((retrosSince / 2) % handles.length) + core.info(`Retros since: ${retrosSince}`) + core.info(`List of handles length: ${handles.length}`) + const index = Math.floor(retrosSince % handles.length) + core.info(`Handle index: ${index}`) const nxt = handles[index] return nxt