Skip to content

feat(settings): expose OverMidnight toggle in the assigned-site dialog - #1659

Merged
renemadsen merged 1 commit into
stablefrom
feat/assigned-site-over-midnight
Jul 22, 2026
Merged

feat(settings): expose OverMidnight toggle in the assigned-site dialog#1659
renemadsen merged 1 commit into
stablefrom
feat/assigned-site-over-midnight

Conversation

@renemadsen

Copy link
Copy Markdown
Member

Summary

  • New "Vagter over midnat" / "Shifts across midnight" checkbox in the assigned-site dialog, shown only when the punch-clock entry method is selected (the flag has no effect for manual/accept-planned entry). Help text explains the automatic midnight split: the shift closes at 00:00 and continues as a new registration the next day (day 1: 22:00–00:00, day 2: 00:00–06:00) — the app handles this; no behavior change server-side.
  • Write-path fix: UpdateAssignedSite never persisted OverMidnight — the DTO and entity both carry the field, but the update service silently dropped it. One assignment added.
  • The value is retained (form control registered unconditionally) when the entry method changes; the checkbox merely hides.
  • 2 new i18n keys × all 26 locales (duplicate-checked, en-dashes byte-verified against the template).

Tests

  • Backend: UpdateAssignedSite_PersistsOverMidnight — true→persisted, false→persisted round-trip in the existing SettingsServiceTests fixture.
  • Frontend: new spec block in assigned-site-dialog.component.spec.ts — visibility per entry method (punch clock / manual / accept-planned), form-control init from model, model sync on toggle.

Verification

Verified live against the local environment and real DB: checkbox renders with correct Danish help text under the punch-clock option; hides on "Manuel indtastning" and returns on punch clock (same as the sibling sub-option); saving true then false round-trips to AssignedSites.OverMidnight with version rows recorded (v9: 0→1, v10: 1→0). Design spec included at docs/superpowers/specs/2026-07-22-assigned-site-overmidnight-design.md.

Note (out of scope, pre-existing)

While verifying, plannings/index for the full site list was found to fail intermittently-by-volume on the local env: the GET path recomputes SumFlex per site in a Task.WhenAll fan-out and concurrent PlanRegistrationVersions inserts hit InnoDB write contention; the catch at PlanRegistrationHelper.cs:1064-1073 then mislabels the save exception as "Could not parse PlanText" and swallows the inner error. Unrelated to this PR (single-site requests work); worth a separate fix (narrow the catch + log inner exception, and serialize/bound the per-site writes).

🤖 Generated with Claude Code

Add a "Shifts across midnight" checkbox under the punch-clock entry
method (the flag has no effect for other entry methods), with help text
explaining the automatic midnight split (day 1: 22:00-00:00, day 2:
00:00-06:00 — handled by the app). Value is retained when the entry
method changes.

Fix the write path: UpdateAssignedSite never persisted OverMidnight, so
the field was silently dropped on save even though the DTO and entity
both carry it.

Adds 2 i18n keys across all 26 locales, a backend persistence
round-trip test, and dialog spec tests for visibility and model sync.
Includes the design spec.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 22, 2026 07:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an “OverMidnight / Shifts across midnight” setting to assigned-site configuration, ensuring the flag is both editable in the Angular dialog (with full i18n coverage) and correctly persisted by the backend update path.

Changes:

  • Backend: persist OverMidnight in UpdateAssignedSite, plus a regression test to verify true/false round-trips.
  • Frontend: add overMidnight to the assigned-site model, wire it into the dialog form + UI, and add unit tests for visibility/init/sync.
  • i18n/docs: add 2 new translation keys across all locales and include a design spec document.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
eFormAPI/Plugins/TimePlanning.Pn/TimePlanning.Pn/Services/TimePlanningSettingService/TimeSettingService.cs Persists OverMidnight during assigned-site updates.
eFormAPI/Plugins/TimePlanning.Pn/TimePlanning.Pn.Test/SettingsServiceTests.cs Adds regression test ensuring OverMidnight is saved on update.
eform-client/src/app/plugins/modules/time-planning-pn/models/assigned-sites/assigned-site.model.ts Extends client-side assigned-site model with overMidnight.
eform-client/src/app/plugins/modules/time-planning-pn/components/plannings/time-planning-actions/assigned-site/assigned-site-dialog.component.ts Registers overMidnight as a dialog form control and syncs it to the model.
eform-client/src/app/plugins/modules/time-planning-pn/components/plannings/time-planning-actions/assigned-site/assigned-site-dialog.component.html Adds the “Shifts across midnight” checkbox (shown only under punch clock).
eform-client/src/app/plugins/modules/time-planning-pn/components/plannings/time-planning-actions/assigned-site/assigned-site-dialog.component.spec.ts Adds unit tests for visibility, initialization, and toggle-to-model sync.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/bgBG.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/csCZ.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/da.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/deDE.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/elGR.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/enUS.ts Adds new “Shifts across midnight” label + help-text translations (source keys).
eform-client/src/app/plugins/modules/time-planning-pn/i18n/esES.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/etET.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/fiFI.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/frFR.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/hrHR.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/huHU.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/isIS.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/itIT.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/ltLT.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/lvLV.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/nlNL.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/noNO.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/plPL.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/ptBR.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/ptPT.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/roRO.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/skSK.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/slSL.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/svSE.ts Adds new “Shifts across midnight” label + help-text translations.
eform-client/src/app/plugins/modules/time-planning-pn/i18n/ukUA.ts Adds new “Shifts across midnight” label + help-text translations.
docs/superpowers/specs/2026-07-22-assigned-site-overmidnight-design.md Documents the UI placement, data flow, and testing approach for the toggle.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 180 to 183
usePunchClock: new FormControl(this.data.usePunchClock),
usePunchClockWithAllowRegisteringInHistory: new FormControl(this.data.usePunchClockWithAllowRegisteringInHistory),
overMidnight: new FormControl(this.data.overMidnight),
allowAcceptOfPlannedHours: new FormControl(this.data.allowAcceptOfPlannedHours),
Comment on lines +693 to +700
function isOverMidnightVisible(c: AssignedSiteDialogComponent): boolean {
let isAdmin = false;
c['selectCurrentUserIsAdmin$']?.subscribe((v: boolean) => (isAdmin = v));
return !c.data.resigned
&& c.data.allowPersonalTimeRegistration
&& isAdmin
&& c.data.usePunchClock;
}
Comment on lines +3 to +5
**Date:** 2026-07-22
**Repos:** `/home/rene/Documents/workspace/microting/eform-angular-timeplanning-plugin` (all changes; base repo untouched)

Comment on lines +8 to +11
`AssignedSites.OverMidnight` (bool, default false) has existed since migration
`20260619120000_AddOverMidnightToAssignedSite` in
`/home/rene/Documents/workspace/microting/eform-timeplanning-base`. The read side is
fully wired: entity → REST DTO (`Infrastructure/Models/Settings/AssignedSite.cs:59`)
@renemadsen
renemadsen merged commit d5c8d99 into stable Jul 22, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants