fix(calendar): thisAndFollowing delete retracts deployed occurrences + add includingCompleted scope#1008
Merged
Conversation
…ces + add includingCompleted scope
Deleting a recurring task with scope "thisAndFollowing" trimmed the recurrence
(planning.RepeatUntil) but left the already-DEPLOYED Compliance rows / SDK cases
for dates >= the clicked date. The compliance-render loop in GetTasksForWeek is
not bounded by RepeatUntil, so those occurrences kept rendering ("not deleted") —
worst-hit for Daily tasks whose every visible day is eagerly deployed.
- thisAndFollowing now retracts deployed occurrences on/after originalDate
(core.CaseDelete + retract PlanningCase/PlanningCaseSite + soft-delete
Compliance), mirroring DeleteEntireSeries / the reconciliation engine. Completed
occurrences (Status==100) are preserved as immutable history.
- New scope "thisAndFollowingIncludingCompleted" (delete-only modal option) ALSO
removes completed occurrences, suppressing their tile via an IsDeleted
CalendarOccurrenceException (the render loop keys completed history off Status==100,
which CaseDelete doesn't change).
- SDK core only opened when there are deployed occurrences to retract (keeps the
never-deployed fast-path working with a null/absent core).
- Kind-safe Deadline comparison; integration tests lock pending-retract,
completed-preserved, and completed-removed behaviors.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes recurring calendar deletion behavior for “this and following” by retracting already-deployed occurrences (SDK cases / PlanningCase bookkeeping / Compliance rows) so they stop rendering, and adds a new delete scope to optionally include completed occurrences.
Changes:
- Backend:
DeleteTasknow retracts deployed occurrences on/afteroriginalDateforthisAndFollowing, preserving completed history by default. - Backend + UI: introduces
thisAndFollowingIncludingCompletedscope and surfaces it as a delete-only radio option. - Tests + i18n: adds integration tests covering retract behavior and adds translations for the new scope label.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/BackendConfigurationCalendarService/BackendConfigurationCalendarService.cs | Retracts deployed occurrences for thisAndFollowing and adds includingCompleted behavior via occurrence exceptions. |
| eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn.Integration.Test/CalendarDeleteThisAndFollowingTests.cs | Adds regression integration tests for deployed-occurrence retraction and completed-occurrence handling. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/modules/calendar/modals/repeat-scope-modal/repeat-scope-modal.component.ts | Extends modal typing to support delete scopes. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/modules/calendar/modals/repeat-scope-modal/repeat-scope-modal.component.html | Adds delete-only radio option for “This and following (incl. completed)”. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/models/calendar/calendar-task-request.model.ts | Extends RepeatDeleteScope union with thisAndFollowingIncludingCompleted. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/bgBG.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/csCZ.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/da.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/deDE.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/elGR.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/enUS.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/esES.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/etET.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/fiFI.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/frFR.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/hrHR.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/huHU.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/isIS.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/itIT.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/ltLT.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/lvLV.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/nlNL.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/noNO.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/plPL.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/ptBR.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/ptPT.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/roRO.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/skSK.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/slSL.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/svSE.ts | Adds translation for new delete scope label. |
| eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/ukUA.ts | Adds translation for new delete scope label. |
Comment on lines
+2158
to
+2172
| if (deployedToRetract.Count > 0) | ||
| { | ||
| var core = await coreHelper.GetCore(); | ||
| await using var sdkDbContext = core.DbContextHelper.GetDbContext(); | ||
|
|
||
| foreach (var compliance in deployedToRetract) | ||
| { | ||
| var sdkCase = await sdkDbContext.Cases | ||
| .SingleOrDefaultAsync(x => x.Id == compliance.MicrotingSdkCaseId); | ||
|
|
||
| // Completed occurrences are immutable history — never retract | ||
| // under the default scope. The includeCompleted scope opts in | ||
| // to removing them too. | ||
| var isCompleted = sdkCase?.Status == 100; | ||
| if (!includeCompleted && isCompleted) |
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.
Bug
User report (DK): deleting a Daily recurring task with "Dette og følgende" ("This and following") → Confirm → the tasks are not deleted.
Root cause
DeleteTaskscopethisAndFollowingtrimmed the recurrence (planning.RepeatUntil) and deleted stale exceptions, but never retracted the already-DEPLOYEDCompliancerows / SDK cases for dates ≥ the clicked date. The compliance-render loop inGetTasksForWeekis not bounded byRepeatUntil, so deployed occurrences kept rendering. Daily tasks are worst-hit (every visible day is eagerly deployed). Pre-existing — scopethis(writes anIsDeletedexception) andall(DeleteEntireSeries) were unaffected.Changes
thisAndFollowingnow retracts deployed occurrences ≥ originalDate —core.CaseDelete+ retractPlanningCase/PlanningCaseSite+ soft-deleteCompliance, mirroringDeleteEntireSeries/ the reconciliation engine. Completed occurrences (Status==100) preserved as immutable history.thisAndFollowingIncludingCompleted): also removes completed occurrences, suppressing the tile via anIsDeletedCalendarOccurrenceException(the calendar renders completed history offStatus==100, whichCaseDeletedoesn't change).Deadlinecomparison.Tests
CalendarDeleteThisAndFollowingTests(Testcontainers + real SDK core): pending-retract, completed-preserved (default), completed-removed (includingCompleted). Verified green together with the existingCalendarOccurrenceExceptionTests(14/14 locally, incl. the null-coreHelperdelete paths).Note
Rebased cleanly on current
stable(preserves #1007'sTaskIsExpiredwork inGetTasksForWeek— disjoint from thisDeleteTaskchange).🤖 Generated with Claude Code