From db9f836b844aa664829354f8d9cf0a1c52bfe5f4 Mon Sep 17 00:00:00 2001 From: Marco van Dijk Date: Sat, 16 Apr 2022 23:26:01 +0200 Subject: [PATCH] Debug in production --- backend/src/routes/livepeer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/routes/livepeer.js b/backend/src/routes/livepeer.js index 856e1bf..cc681ed 100644 --- a/backend/src/routes/livepeer.js +++ b/backend/src/routes/livepeer.js @@ -1179,12 +1179,12 @@ const getScoreAtMonthYear = async function (month, year) { } } // Calculate UTC timestamps for this month - const fromString = year + '-' + zeroPad(month, 2) + '-01T00:00:00.000Z'; + const fromString = year + '-' + zeroPad(month + 1, 2) + '-01T00:00:00.000Z'; let endString; - if (month > 10) { + if (month > 11) { endString = (year + 1) + '-' + '01-01T00:00:00.000Z'; } else { - endString = year + '-' + zeroPad((month + 1), 2) + '-01T00:00:00.000Z'; + endString = year + '-' + zeroPad((month + 2), 2) + '-01T00:00:00.000Z'; } const startTime = parseInt(Date.parse(fromString) / 1000); const endTime = parseInt(Date.parse(endString) / 1000) @@ -1231,7 +1231,7 @@ apiRouter.post("/getOrchestratorScores", async (req, res) => { const { month, year } = req.body; if (month && year) { // Since months get counted starting at 0 - const reqObj = await getScoreAtMonthYear(month + 1, year); + const reqObj = await getScoreAtMonthYear(month, year); res.send(reqObj); return; }