Skip to content

feat(plannings): the day dialog lists each shift's pause start and stop times (#1741) - #1749

Merged
renemadsen merged 2 commits into
stablefrom
fix/1741-pause-times-day-dialog
Oct 4, 2026
Merged

renemadsen merged 2 commits into
stablefrom
fix/1741-pause-times-day-dialog

Conversation

@renemadsen

Copy link
Copy Markdown
Member

Summary

The customer asked to see pause start and stop times on the web. Until now the board and the day dialog showed only pause durations. The dialog now lists each shift's recorded pauses under its pause field, one line each, e.g. "Pause 10:02–10:17".

How

  • New pause-segments.util.ts (buildPauseSegments) applies the rules of the backend's BuildMergedPauseSegments / ResolveShiftSeconds:
    • a stop on a later day is clamped to 24:00;
    • a pair whose stop is not after its start is dropped;
    • the remaining pauses are sorted, and overlapping or touching ones are merged.
  • Merging is per shift, so the list sits under the shift it belongs to. The backend merges across all of the day's shifts.
  • A pause with a start and no stop is still running and is shown open-ended ("10:02–…"). A stop with no start is skipped.
  • The dialog builds the list once per shift (1–5) from its existing slot grouping: shift 1 is pause1, 10–19 and 100–102; shift 2 is pause2, 20–29 and 200–202.
  • A shift with a pause override lists nothing. For such a shift ProjectPauseOverridesOntoDto replaces the stamps with one synthesized pair carrying the override's length, so they are not times anyone recorded.

Deliberate choices

  • The ranges show the recorded exact minutes (HH:mm, UTC like the rest of the grid) under 5-minute intervals too, the same way the grid already shows shift stamps. They are not rounded to 5 minutes.
  • There is no shared C# test vector, because BuildMergedPauseSegments is private. The TypeScript version is covered by its own Jest cases.
  • The optional tooltip on the board cell's pause icon is not part of this PR.

Tests

  • Jest pause-segments.util.spec.ts: an empty shift, out-of-order slots, overlapping and touching merges, an open pause, the past-midnight clamp, and invalid pairs.
  • Jest workday-entity-dialog.component.spec.ts: sub-slot and primary-slot pauses are grouped and ordered per shift, an open pause appears on shift 2, and an overridden shift lists nothing.
  • Playwright s/day-dialog-pause-times.spec.ts: the test intercepts the grid's index response (nothing is written to the database).
    • It injects two out-of-order shift-1 pauses on one of last week's days, clears that day's other pause slots, and asserts the reload actually patched a row.
    • It then opens the day by worker name and asserts both ranges in clock order, and no list for shift 2.

Not verified

The tests were not run locally (they run in CI only), and the Angular code was not compiled locally. The util passes tsc --strict on its own, and the spec type-checks against the frontend's Playwright types.

Refs #1741

🤖 Generated with Claude Code

…op times (#1741)

The web showed only pause totals, although the DTO already carries the
recorded Pause{N}StartedAt/StoppedAt stamps. The day dialog now lists
each shift's pauses as read-only clock ranges ("Pause 10:02–10:17"),
built by buildPauseSegments, which applies the rules of the backend's
BuildMergedPauseSegments per shift. A pause that is still running is
shown open-ended. A shift with a pause override lists nothing, because
its served stamps are synthesized.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 3, 2026 05:04

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.

Copilot review overview

🟡 Changes recommended

Zone-less production timestamps display incorrectly outside UTC, and shared unit-test state causes a new test to fail.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Adds recorded pause ranges to each shift in the workday dialog.

Changes:

  • Builds, sorts, and merges pause segments.
  • Displays pause ranges per shift while respecting overrides.
  • Adds unit and Playwright coverage.
File Description
workday-entity-dialog.component.ts Builds pause segments per shift.
workday-entity-dialog.component.spec.ts Tests grouping and overrides.
workday-entity-dialog.component.html Renders pause ranges.
pause-segments.util.ts Implements pause normalization and merging.
pause-segments.util.spec.ts Tests segment-building rules.
day-dialog-pause-times.spec.ts Adds end-to-end dialog coverage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

…ther cases leave behind (#1741)

The dialog spec shares one data object across the suite, and the Approach C
"prefers the served override" case leaves pause1OverrideMinutes set. The
recorded-pause block now clears every override and stamp it reads before
each case as well as after, so shift 1 is not seen as overridden.

buildPauseSegments now also accepts the Date stamps the core DateInterceptor
hands the dialog (date-fns parseJSON, zone-less strings read as UTC), with a
case covering that shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 3, 2026 08:47

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.

Copilot review overview

🟢 Approval recommended

The implementation matches the documented backend rules and has focused coverage across utility, component, and browser layers.

Review effort: Balanced
Findings: None

Resolved since last review (2)

@renemadsen
renemadsen merged commit d8bc5d8 into stable Oct 4, 2026
41 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