feat: pass vacationMap from storage to calculateAllEmployees
This commit is contained in:
parent
68f35d3e3d
commit
34e9e67f6d
1 changed files with 12 additions and 1 deletions
13
app.js
13
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue