feat: pass vacationMap from storage to calculateAllEmployees

This commit is contained in:
Kenearos 2026-05-12 18:22:06 +02:00
parent 68f35d3e3d
commit 34e9e67f6d

13
app.js
View file

@ -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);