Skip to content

feat(settings): registration-device worker list carries today's start time (#1742) - #1751

Merged
renemadsen merged 2 commits into
stablefrom
fix/1742-shift-started-at
Oct 4, 2026
Merged

renemadsen merged 2 commits into
stablefrom
fix/1742-shift-started-at

Conversation

@renemadsen

Copy link
Copy Markdown
Member

Summary

The registration-device (tablet) worker list can now show when each worker clocked in today.

  • Site (REST model) gets DateTime? ShiftStartedAt: the earliest Start1..5StartedAt of today's PlanRegistration, or null when no shift has started. It is computed from the same row that sets HoursStarted, in GetAvailableSites and in BuildSitesFromAssignedSitesAsync. That builder serves GetAllRegistrationSitesByCurrentUser and the web's GetAvailableSitesByCurrentUser.
  • gRPC Site gets the additive field string shift_started_at = 25. The value uses the same format as the other *_started_at strings: FormatDateTime is now internal and shared. It is empty when the worker has not started. No existing field changed.

The stored start stamps are naive wall-clock time, not UTC, so the value is sent as a string the app already knows how to parse. It is not sent as a Timestamp.

Tests

  • SettingsServiceExtendedTests: for both service entry points, a worker who started at 06:58 and again at 12:30 returns 06:58, and a worker with a plan row but no start returns null.
  • TimePlanningSettingsGrpcServiceTests: for both gRPC endpoints, the field maps to 2026-10-01T06:58:00, and to empty when the worker has not started.

Not verified

  • Tests were not run locally; CI runs them.
  • The app side (flutter-time#591) is separate.

Refs #1742

🤖 Generated with Claude Code

… time (#1742)

The tablet worker list only knew whether a worker had started (HoursStarted),
not when. Site gains ShiftStartedAt, the earliest StartNStartedAt of today's
row, filled in GetAvailableSites and in the shared site builder behind
GetAllRegistrationSitesByCurrentUser. gRPC Site gets the additive field
string shift_started_at = 25, in the same naive wall-clock format as the
other *_started_at strings (FormatDateTime), empty when not started.

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

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 additive contract change is consistently implemented across both entry points with appropriate coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Adds today’s earliest worker clock-in time to REST and gRPC registration-site responses.

Changes:

  • Computes ShiftStartedAt from today’s registration.
  • Adds and maps the additive gRPC field.
  • Covers started and not-started workers in service tests.
File Description
TimeSettingService.cs Computes the earliest shift start.
TimePlanningWorkingHoursGrpcService.cs Shares date-time formatting.
TimePlanningSettingsGrpcService.cs Maps shift start into gRPC responses.
settings.proto Adds shift_started_at.
Site.cs Adds the nullable REST property.
SettingsServiceExtendedTests.cs Tests service-level behavior.
TimePlanningSettingsGrpcServiceTests.cs Tests gRPC mapping.

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

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

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 3 Medium severity · 1 Low severity

Open (4)

Comment on lines +1029 to +1039
var today = DateTime.UtcNow.Date;
await new PlanRegistration
{
SdkSitId = startedSiteUid,
Date = today,
Start1StartedAt = today.AddHours(6).AddMinutes(58),
Stop1StoppedAt = today.AddHours(11),
Start2StartedAt = today.AddHours(12).AddMinutes(30),
CreatedByUserId = 1,
UpdatedByUserId = 1
}.Create(TimePlanningPnDbContext);
Comment on lines +1068 to +1070
var today = DateTime.UtcNow.Date;
Assert.That(result.Model.Single(x => x.SiteId == 15000).ShiftStartedAt,
Is.EqualTo(today.AddHours(6).AddMinutes(58)));
Comment on lines +189 to 190
internal static string FormatDateTime(DateTime? dt) =>
dt?.ToString("yyyy-MM-ddTHH:mm:ss.FFFFFF") ?? "";
Comment on lines +1486 to +1494
// Min over DateTime? skips nulls, and is null when all are.
return new[]
{
planRegistration.Start1StartedAt,
planRegistration.Start2StartedAt,
planRegistration.Start3StartedAt,
planRegistration.Start4StartedAt,
planRegistration.Start5StartedAt
}.Min();
@renemadsen
renemadsen merged commit 04fa9ae 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