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)
This commit is contained in:
2026-04-30 17:59:04 +02:00
parent 6fceda46b5
commit c675a7b01d
3 changed files with 39 additions and 12 deletions

View File

@@ -48,7 +48,7 @@ func main() {
entrySvc := service.NewEntryService(entryStore, closedDayStore, settingsStore, tz)
daySvc := service.NewDayService(entryStore, closedDayStore, settingsStore, tz)
settingsSvc := service.NewSettingsService(settingsStore)
weekSvc := service.NewWeekService(closedDayStore, closedWeekStore, settingsStore, db, tz)
weekSvc := service.NewWeekService(closedDayStore, closedWeekStore, entryStore, settingsStore, db, tz)
// Background goroutine: auto-stop entries that cross midnight
ctx, cancel := context.WithCancel(context.Background())