From 1da4b0dfa93b85b0ef09fa0c6ef03e041c191a7d Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Tue, 2 Feb 2021 11:11:08 +0530 Subject: [PATCH] :bug: Fix summary fetcher --- index.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/index.ts b/index.ts index 14ed3d1..fff6b92 100644 --- a/index.ts +++ b/index.ts @@ -192,6 +192,20 @@ export const rescuetimeSlack = async () => { summaries[0] ); console.log(`Posted ${user}'s summary to Slack`); + } else { + const summaries = await fetchDailySummary( + config.apiKeys[user].replace( + "$API_KEY", + process.env[ + `API_KEY_${user.toLocaleUpperCase().replace(/ /g, "_")}` + ] ?? "" + ) + ); + if (!summaries.length) continue; + totalHours += summaries[0].total_hours; + totalScore += Math.floor( + summaries[0].total_hours * summaries[0].productivity_pulse + ); } } if (process.argv[2] !== "individual" && process.argv[2] !== "weekly") {