Commit Graph

16 Commits

Author SHA1 Message Date
185bb0c6a9 revert: display closedWeek.delta_ms in closed-week banner 2026-04-30 18:17:19 +02:00
47c7a97d47 fix: keep closed week snapshot in sync when days change
When a day is closed, re-closed, or reopened, DayService now
recomputes worked_ms and delta_ms on the closed week containing
that day (if the week is already closed). This prevents stale
delta values after editing entries and re-closing a day.

- DayService.recomputeWeek: sums worked_ms from all closed_days
  in the week, updates closed_weeks row preserving expected_ms
- NewDayService now takes ClosedWeekStore
- WeekKeyForDayKey exported helper (used by DayService)
- TestWeekSnapshotUpdatesWhenDayReopened regression test
2026-04-30 18:16:22 +02:00
78c2c7c8a5 fix: show live delta in closed-week banner instead of stale frozen value
closedWeek.delta_ms is a snapshot taken at close time and goes stale
if entries are edited or days are re-closed afterward. The summary
rows above already use the live totalWorkedMs - expectedMs; the
closed-week banner now uses the same expression.
2026-04-30 18:12:34 +02:00
3fd1455704 fix: hide close-week button when a tracked day is still open
Fetch entries for the week alongside days/weeks in the week view.
canCloseWeek now mirrors the server rule: every past workday that
has at least one entry must have a closed_days record. Days with
no entries are still skipped (they count as 0h implicitly).
2026-04-30 18:10:44 +02:00
563784d5fb fix: show Close week button without requiring all workdays closed
The frontend was blocking week close until every workday had a
closed_days record, which no longer matches the backend's rules
(untracked days are implicitly 0h). Replace the all-workdays-closed
guard with a simple check: week has started (Monday ≤ today) and
is not already closed. The server returns a clear error if a day
with entries still needs closing.

Also fixes a pre-existing TS type narrowing error on currentSettings
and removes the now-unused .hint CSS rule.
2026-04-30 18:08:06 +02:00
c675a7b01d fix: skip untracked workdays when closing a week
Previously any past workday without a closed_days record blocked week
close. Now only days that actually have entries require an explicit
close. Empty workdays count as 0h worked, which is reflected in the
weekly delta automatically.

- WeekService.CloseWeek: after finding no closed_days record, check
  whether the day has any entries; only error if it does
- NewWeekService: takes EntryStore to support the above check
- Updated TestCloseWeekMissingDayFails to reflect the new semantic
  (test now creates entries on Friday but leaves it unclosed)
2026-04-30 17:59:04 +02:00
6fceda46b5 fix: allow closing current week when future workdays are not yet closed
CloseWeek was requiring every workday in the ISO week to have a
closed_days record, including days in the future. Now only workdays
up to and including today are checked; future workdays are skipped.

Adds TestCloseWeekMidWeek regression test.
2026-04-30 17:54:38 +02:00
9d6233b116 feat: add manual interval creation and inline entry editing
- Service: CreateInterval() validates same-day, end>start, day not closed
- Service: Update() now rejects edits on closed-day entries (ErrDayAlreadyClosed)
- Handler: POST /api/entries creates a completed interval with explicit times
- API client: entries.createInterval(startMs, endMs, note)
- Utils: parseTimeInput / toTimeInput helpers for HH:MM <-> unix ms
- Today page: '+ Add interval' form (time pickers + optional note)
- Today page: pencil button on each entry opens inline edit row (start/end/note)
- Tests: TestCreateInterval, TestCreateIntervalEndBeforeStart,
         TestCreateIntervalCrossesMidnight, TestUpdateRejectsClosedDay
2026-04-30 17:45:02 +02:00
245edf1534 chore: add mise.toml for tool versions and tasks, thin Makefile shim 2026-04-30 17:35:28 +02:00
2055a46dee feat(m6): CSV export, Makefile, README, single-binary build 2026-04-30 16:48:44 +02:00
4a328ad6cc feat(m5): PWA service worker, offline Dexie store, outbox, sync endpoints 2026-04-30 16:47:27 +02:00
df04d9d7a9 feat(m4): SvelteKit frontend - today, week, history, settings views 2026-04-30 16:45:00 +02:00
d0ef0387f2 feat(m3): week close, overtime/undertime delta, frozen settings snapshot 2026-04-30 16:39:42 +02:00
4a0e0c8318 feat(m2): settings history, close day, holiday/vacation/sick marking 2026-04-30 16:37:56 +02:00
3aa068efd2 feat(m1): backend scaffold - entries CRUD, start/stop, auth, migrations 2026-04-30 16:35:06 +02:00
4905c6f570 docs: add implementation plan 2026-04-30 16:24:39 +02:00