diff --git a/js/algorithm.js b/js/algorithm.js index 9401509..b7bddfe 100644 --- a/js/algorithm.js +++ b/js/algorithm.js @@ -37,7 +37,7 @@ function isEligible(employee, isoDate, monthAssignments, allHistory) { if (count >= c.maxPerMonth) return false; } - if (c.minGapDays > 0) { + if (c.minGapDays != null && c.minGapDays > 0) { // Latest prior assignment date for this employee — single pass, no sort/alloc let lastDate = null; const isLater = a => a.employeeId === employee.id && a.date < isoDate && diff --git a/js/app.js b/js/app.js index e5b1ca3..db0463f 100644 --- a/js/app.js +++ b/js/app.js @@ -26,8 +26,9 @@ try { state.settings = { moderatorsPerDay: parsed.settings.moderatorsPerDay }; } } -} catch { - // Corrupt storage — start fresh +} catch (e) { + // Corrupt storage — start fresh, but leave a breadcrumb for debugging + console.warn('Gespeicherter Zustand konnte nicht gelesen werden, starte leer:', e); } // Persist immediately. Used by the debounced saveState and the flush handlers. diff --git a/js/calendar.js b/js/calendar.js index bee6e4e..27b4924 100644 --- a/js/calendar.js +++ b/js/calendar.js @@ -99,13 +99,13 @@ export function renderCalendar() { renderGrid(wrapper, exportBtn); monthSel.addEventListener('change', () => { - currentMonth = parseInt(monthSel.value); + currentMonth = parseInt(monthSel.value, 10); loadPlanFromHistory(); renderGrid(wrapper, exportBtn); }); yearSel.addEventListener('change', () => { - currentYear = parseInt(yearSel.value); + currentYear = parseInt(yearSel.value, 10); loadPlanFromHistory(); renderGrid(wrapper, exportBtn); }); diff --git a/js/employees.js b/js/employees.js index 94bf31d..9def871 100644 --- a/js/employees.js +++ b/js/employees.js @@ -54,7 +54,8 @@ export function renderEmployees() { if (!name) return; try { state.employees.push(createEmployee(name)); - } catch { + } catch (err) { + console.warn('Mitarbeiter konnte nicht angelegt werden:', err); return; } nameInput.value = '';