From 34e9e67f6d36ce3bcb64c8f417f65a52682618f6 Mon Sep 17 00:00:00 2001 From: Kenearos Date: Tue, 12 May 2026 18:22:06 +0200 Subject: [PATCH] feat: pass vacationMap from storage to calculateAllEmployees --- app.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 0247623..6884375 100644 --- a/app.js +++ b/app.js @@ -335,9 +335,17 @@ class DienstplanApp { const month = parseInt(monthSelect.value); const year = parseInt(yearSelect.value); + const yearMonth = `${year}-${String(month).padStart(2, '0')}`; const employeeDuties = this.storage.getAllEmployeeDutiesForMonth(year, month); - const results = this.calculator.calculateAllEmployees(employeeDuties); + + // Build vacation map for this month: { name: boolean } + const vacationMap = {}; + Object.keys(employeeDuties).forEach(name => { + vacationMap[name] = this.storage.getVacationMode(name, yearMonth); + }); + + const results = this.calculator.calculateAllEmployees(employeeDuties, vacationMap); const monthNames = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']; @@ -350,6 +358,9 @@ class DienstplanApp { return; } + // Stash current calc context for vacation-toggle handler + this._currentCalcContext = { year, month, yearMonth }; + employees.forEach(employeeName => { const result = results[employeeName]; const resultCard = this.createResultCard(employeeName, result);