fix(events): populate TaskIsExpired on calendar + stream paths so mobile overdue list survives refresh#1007
Merged
Conversation
…ile overdue list survives refresh
The mobile overdue ("red tasks") list and the calendar share one client
Drift cache keyed by (eventId, planDayKey, complianceId). Only
ListTaskTracker set task_is_expired=true; ListEvents and StreamEventChanges
re-upserted the same current-week rows with task_is_expired=false (the flag
was never computed on those paths, so it defaulted to proto3 false),
clobbering the tracker's value. The overdue list populated briefly and then
collapsed to empty.
GetTasksForWeek now computes CalendarTaskResponseModel.TaskIsExpired on all
emit phases (recurrence-expansion, orphan-anchor, moved-in, compliance),
and ListEvents + LoadEventsAsync forward it, so all paths agree. The shared
expiry predicate (previously duplicated in GetTaskTrackerList) is extracted
into a single ComputeTaskIsExpired helper.
Verified over gRPC: ListEvents past-due rows now return task_is_expired=true;
ListTaskTracker unchanged (11/23 expired). Reproduced on device and confirmed
the overdue list now holds instead of collapsing to 0.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a mobile/web calendar consistency issue by ensuring the backend computes and propagates TaskIsExpired on the calendar/week and event-stream gRPC paths, preventing the mobile Drift cache from being overwritten with proto3-default false values.
Changes:
- Computes
CalendarTaskResponseModel.TaskIsExpiredthroughoutGetTasksForWeek, and centralizes the predicate intoComputeTaskIsExpired. - Forwards
TaskIsExpiredinto the gRPCEventmessage inEventsGrpcServiceforListEventsand the stream’s load path. - Updates model documentation to reflect that both task-tracker and calendar-week paths populate the field.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/GrpcServices/EventsGrpcService.cs | Adds TaskIsExpired to Event projection for list + stream load paths. |
| eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/BackendConfigurationCalendarService/BackendConfigurationCalendarService.cs | Computes TaskIsExpired across week-view emit phases and factors out shared predicate. |
| eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Infrastructure/Models/Calendar/CalendarTaskResponseModel.cs | Updates XML doc to reflect TaskIsExpired is now populated by both service paths. |
Comment on lines
+269
to
+275
| .ToDictionary(g => g.Key, g => | ||
| { | ||
| var first = g.First(); | ||
| var sc = first.MicrotingSdkCaseId > 0 ? sdkCasesById.GetValueOrDefault(first.MicrotingSdkCaseId) : null; | ||
| var expired = ComputeTaskIsExpired(sc, first.Deadline, dateTimeNow); | ||
| return (ComplianceId: first.Id, SdkCaseId: first.MicrotingSdkCaseId, TaskIsExpired: expired); | ||
| }); |
Comment on lines
+989
to
+993
| var compSdkCase = compliance.MicrotingSdkCaseId > 0 | ||
| ? weekComplianceCasesById.GetValueOrDefault(compliance.MicrotingSdkCaseId) | ||
| : null; | ||
| var compTaskIsExpired = ComputeTaskIsExpired(compSdkCase, effectiveTaskDate, dateTimeNow); | ||
|
|
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.
Problem
Customer-reported: overdue "red tasks" visible in the Angular web calendar do not appear in the flutter-eform mobile overdue list.
Root cause
The mobile overdue list (
ListTaskTracker) and calendar (ListEvents/StreamEventChanges) share one client Drift cache keyed by(eventId, planDayKey, complianceId). OnlyListTaskTrackersettask_is_expired=true. The calendar/stream paths never computed the flag, so it serialized as proto3-defaultfalse, and re-upserting the same current-week rows clobbered the tracker'strue. The overdue list briefly populated then collapsed to empty.Fix
GetTasksForWeeknow computesCalendarTaskResponseModel.TaskIsExpiredon every emit phase (recurrence-expansion, orphan-anchor, moved-in, compliance), mirroringGetTaskTrackerList.EventsGrpcService.ListEventsandLoadEventsAsyncforwardTaskIsExpiredon theEventmessage.Removed && Status==77, or past-dueeffectiveDate < today && Status != 100, else date-only) into a singleComputeTaskIsExpiredhelper, removing 3 duplicated copies.Verification
ListEventspast-due rows now returntask_is_expired=true(wasfalse);ListTaskTrackerunchanged at 11/23 expired (no regression). Re-confirmed after each rebuild.🤖 Generated with Claude Code