15 Commits
Author SHA1 Message Date
ferdi2goandClaude Opus 4.8 189bcb6f38 test: add jsdom render + persistence integration tests (#13)
- render.test.mjs drives the real UI under jsdom: employees tab renders and
  add works, planning tab renders the calendar grid (makeDayCell), generate
  fills slots, a manual slot change updates history, and a beforeunload flush
  persists state to localStorage; data tab renders the history view.
- persistence.test.mjs seeds malformed persisted state (employee without
  constraints, out-of-range moderatorsPerDay) and asserts the startup load
  normalizes it without crashing.
- jsdom added as the single devDependency; node_modules gitignored; both
  suites wired into npm test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 14:03:00 +00:00
ferdi2goandClaude Opus 4.8 fd9870871b refactor: centralize shared date/name helpers in utils.js (#12)
New js/utils.js exports toISO, monthPrefix, getWeekday, formatDateDE and
buildNameMap. algorithm.js, calendar.js, excel.js and history.js now import
these instead of re-implementing ISO construction, weekday math, DD.MM.YYYY
formatting and the id→name map inline. Adds tests/utils.test.mjs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 13:01:28 +00:00
ferdi2goandClaude Opus 4.8 e6452fa102 fix(excel): neutralize formula injection in exported names (#7)
Adds sanitizeCell(): cell values starting with = + - @ or a control char are
prefixed with an apostrophe so spreadsheets render them as literal text
instead of executing them as formulas. Applied to the names column.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 12:37:32 +00:00
ferdi2goandClaude Opus 4.8 142e0efa1f fix(employees): remove history entries when deleting an employee (#5)
removeEmployee now also filters the deleted employee's history entries, so
no orphaned "(unbekannt)" rows remain. Adds a test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 12:29:16 +00:00
ferdi2goandClaude Opus 4.8 065876ced4 fix(import): validate/normalize imported data, guard Excel I/O (#3)
- loadFromJSON and the localStorage startup load now run employees through
  normalizeEmployees(): fills missing constraints, drops unusable rows,
  de-duplicates ids, and discards invalid vacation ranges — preventing
  later crashes (e.g. c.neverDays on undefined) and same-day double-books.
- Excel import is wrapped in try/catch with a typeof XLSX guard and user
  feedback; the Excel export button gets the same guard.
- createEmployee reuses the shared defaultConstraints() factory.

Adds normalizeEmployees tests (defaults, dropping, dedup, vacations) and a
loadFromJSON normalization test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 12:20:41 +00:00
ferdi2goandClaude Opus 4.8 e851bb2833 fix(calendar): preserve manual picks when regenerating a month (#2)
generatePlan gains a preAssigned parameter: manual entries occupy slots,
count toward eligibility (maxPerMonth/minGap) and are never double-booked;
only the remaining slots per day are auto-filled. The generate handler now
keeps manual:true entries for the month instead of wiping them.

Adds tests for slot occupation, fully-manual days, and maxPerMonth counting.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 12:17:22 +00:00
ferdi2go 69e424519d feat(excel): group entries by date, join names with ' & ' 2026-04-28 11:03:05 +00:00
ferdi2go a825a63961 feat(data): settings.moderatorsPerDay in load/save JSON 2026-04-28 10:38:51 +00:00
ferdi2go 7bda92a0a3 feat(data): removeHistoryEntry supports optional employeeId 2026-04-28 10:31:38 +00:00
ferdi2go 23683102bc feat(data): dedupe history by (date, employeeId) 2026-04-28 10:21:18 +00:00
ferdi2go 3d314e84fd feat(algo): skip day when candidates < slotsPerDay 2026-04-28 10:07:22 +00:00
ferdi2go 625f9c7037 feat(algo): slotsPerDay parameter for top-N selection 2026-04-28 09:59:44 +00:00
ferdi2go 790ea72987 refactor: generatePlan returns {assignments, skippedDates} 2026-04-28 09:55:25 +00:00
Ferdinand adf656c9f3 test: add missing tests for companyClosures, lowPriorityDays, and manual flag 2026-04-08 13:16:46 +02:00
FerdinandandClaude Sonnet 4.6 b5cfe5b336 feat: algorithm module with unit tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 13:10:49 +02:00