From 2fe421e8569658c92c262b3fc0c134213ee031f0 Mon Sep 17 00:00:00 2001 From: Maria Katrin Bonde Date: Fri, 10 Jan 2025 09:40:42 +0100 Subject: [PATCH] tests failed, checking if changes made to test consultant were the cause --- frontend/mockdata/mockData.ts | 8 ++++---- .../src/components/Forecast/TransformWeekDataToMonth.ts | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/mockdata/mockData.ts b/frontend/mockdata/mockData.ts index 367dd6e2..80b9cf8b 100644 --- a/frontend/mockdata/mockData.ts +++ b/frontend/mockdata/mockData.ts @@ -17,7 +17,7 @@ const MockWeeklyBookingReadModel: WeeklyBookingReadModel = { totalSellableTime: 0, totalBillable: 0, totalOffered: 0, - totalVacationHours: 10, + totalVacationHours: 0, totalExcludableAbsence: 0, totalNotStartedOrQuit: 0, }; @@ -79,11 +79,11 @@ export const MockConsultants: ConsultantReadModel[] = [ department: { id: "mydepartment", name: "My Department" }, bookings: [ { - year: 2025, - weekNumber: 14, + year: 2023, + weekNumber: 10, dateString: "", bookingModel: MockWeeklyBookingReadModel, - sortableWeek: 202514, + sortableWeek: 202310, }, ], yearsOfExperience: 23, diff --git a/frontend/src/components/Forecast/TransformWeekDataToMonth.ts b/frontend/src/components/Forecast/TransformWeekDataToMonth.ts index 52f057f8..ffdcf923 100644 --- a/frontend/src/components/Forecast/TransformWeekDataToMonth.ts +++ b/frontend/src/components/Forecast/TransformWeekDataToMonth.ts @@ -17,12 +17,12 @@ function transformToMonthlyData(weeklyData: BookedHoursPerWeek[]) { const { year, weekNumber, bookingModel } = week; const monthDistribution = getMonthOfWeek({ week: weekNumber, year: year }); const primaryMonthKey = `${monthDistribution.year}-${String( - monthDistribution.month + 1, + monthDistribution.month, ).padStart(2, "0")}`; const secondaryMonthKey = monthDistribution.secondMonth !== undefined ? `${monthDistribution.year}-${String( - monthDistribution.secondMonth + 1, + monthDistribution.secondMonth, ).padStart(2, "0")}` : null; @@ -76,6 +76,7 @@ function transformToMonthlyData(weeklyData: BookedHoursPerWeek[]) { addToMonthlyData(secondaryMonthKey, secondaryBookingModel!); } }); + console.log("monthlyData", Object.values(monthlyData)); return Object.values(monthlyData); }