Repository navigation
feat(settings): registration-device worker list carries today's start time (#1742) - #1751
Merged
Merged
Conversation
… 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>
There was a problem hiding this comment.
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
ShiftStartedAtfrom 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>
There was a problem hiding this comment.
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
Open (4)
These tests computeDateTime.UtcNow.Datein multiple places (inside the seed helper and again… · New These tests computeDateTime.UtcNow.Datein multiple places (inside the seed helper and again… · New For wire-format stability, format usingCultureInfo.InvariantCulturerather than the current… · New This allocates a new array and uses LINQ for every site mapping, which adds avoidable overhead on… · New
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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
The registration-device (tablet) worker list can now show when each worker clocked in today.
Site(REST model) getsDateTime? ShiftStartedAt: the earliestStart1..5StartedAtof today'sPlanRegistration, or null when no shift has started. It is computed from the same row that setsHoursStarted, inGetAvailableSitesand inBuildSitesFromAssignedSitesAsync. That builder servesGetAllRegistrationSitesByCurrentUserand the web'sGetAvailableSitesByCurrentUser.Sitegets the additive fieldstring shift_started_at = 25. The value uses the same format as the other*_started_atstrings:FormatDateTimeis nowinternaland 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 to2026-10-01T06:58:00, and to empty when the worker has not started.Not verified
Refs #1742
🤖 Generated with Claude Code