From 229a86e7be91b6ccfec410e7a1a84e2882378b3e Mon Sep 17 00:00:00 2001 From: fallow64 Date: Wed, 27 Nov 2024 14:04:26 -0600 Subject: [PATCH] offset yearly datapoints locally --- src/util/gracc.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/gracc.ts b/src/util/gracc.ts index b11b4d2..8aff740 100644 --- a/src/util/gracc.ts +++ b/src/util/gracc.ts @@ -219,6 +219,13 @@ export async function generateReports(date?: Date): Promise { start.setDate(1); const yearly = await graccQuery(start, end, "month", 0, summaryIndex); + yearly.dataPoints = yearly.dataPoints.map((point) => { + // add a couple days so the date is for sure in the correct month + let timestamp = new Date(point.timestamp); + timestamp = new Date(timestamp.getTime() + 1000 * 60 * 60 * 24 * 2); + return { ...point, timestamp: timestamp.toISOString() }; + }); + const yearlySum = yearly.dataPoints.slice(-12-1, -1).reduce( (acc, point) => { acc.sumJobs += point.nJobs;