Skip to content

fix(calendar): thisAndFollowing delete retracts deployed occurrences + add includingCompleted scope#1008

Merged
renemadsen merged 1 commit into
stablefrom
feature/calendar-delete-this-and-following
Jun 16, 2026
Merged

fix(calendar): thisAndFollowing delete retracts deployed occurrences + add includingCompleted scope#1008
renemadsen merged 1 commit into
stablefrom
feature/calendar-delete-this-and-following

Conversation

@renemadsen

Copy link
Copy Markdown
Member

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

DeleteTask scope thisAndFollowing trimmed the recurrence (planning.RepeatUntil) and deleted stale exceptions, but never retracted the already-DEPLOYED Compliance rows / SDK cases for dates ≥ the clicked date. The compliance-render loop in GetTasksForWeek is not bounded by RepeatUntil, so deployed occurrences kept rendering. Daily tasks are worst-hit (every visible day is eagerly deployed). Pre-existing — scope this (writes an IsDeleted exception) and all (DeleteEntireSeries) were unaffected.

Changes

  • Fix: thisAndFollowing now retracts deployed occurrences ≥ originalDate — core.CaseDelete + retract PlanningCase/PlanningCaseSite + soft-delete Compliance, mirroring DeleteEntireSeries / the reconciliation engine. Completed occurrences (Status==100) preserved as immutable history.
  • New option "This and following (incl. completed)" (delete-only radio → scope thisAndFollowingIncludingCompleted): also removes completed occurrences, suppressing the tile via an IsDeleted CalendarOccurrenceException (the calendar renders completed history off Status==100, which CaseDelete doesn't change).
  • SDK core only opened when there are deployed occurrences to retract (preserves the never-deployed fast-path with a null/absent core).
  • Kind-safe Deadline comparison.

Tests

CalendarDeleteThisAndFollowingTests (Testcontainers + real SDK core): pending-retract, completed-preserved (default), completed-removed (includingCompleted). Verified green together with the existing CalendarOccurrenceExceptionTests (14/14 locally, incl. the null-coreHelper delete paths).

Note

Rebased cleanly on current stable (preserves #1007's TaskIsExpired work in GetTasksForWeek — disjoint from this DeleteTask change).

🤖 Generated with Claude Code

…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>
Copilot AI review requested due to automatic review settings June 16, 2026 13:51

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.

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: DeleteTask now retracts deployed occurrences on/after originalDate for thisAndFollowing, preserving completed history by default.
  • Backend + UI: introduces thisAndFollowingIncludingCompleted scope 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)
@renemadsen renemadsen merged commit 46d0290 into stable Jun 16, 2026
27 checks passed
@renemadsen renemadsen deleted the feature/calendar-delete-this-and-following branch June 16, 2026 14:08
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