Skip to content

Deleting a schedule (rule) erases historical passive/active on-call data #38

Description

@wiseelf

Problem

On-call billing (OnCallBilling.passiveMinutes/activeMinutesWithinBillable) is fully derived at render time from the current rules + exceptions + rotations — nothing records "day X was on-call" independently of the rule that generated it.

Deleting a schedule (RecurrenceRule) in the Schedule tab doesn't just stop future on-call generation — it retroactively erases passive/active on-call hours for every already-elapsed day that rule used to cover, since OnCallBilling recomputes everything live against whatever rules currently exist. Past Stats and Reports for those days silently change after the rule is gone.

Desired behavior

  • Already-elapsed on-call days a deleted rule generated should keep showing their passive/active hours in Stats/Reports, unaffected by the deletion.
  • Only future occurrences of the rule should actually stop.
  • The preserved historical days should respect exceptions (skips/overrides) that were applied while the rule was active — a skipped day stays off, an overridden day keeps its overridden window. The frozen history should match exactly what was shown before deletion.

Needs brainstorming before implementation

Two candidate approaches were raised, not yet decided:

  1. Freeze into rotation blocks — before deleting, convert every already-elapsed on-call day the rule generated (through today), with exceptions already resolved, into a permanent OnCallRotationBlock. Reuses the existing, tested rotation-block data path; past Stats/Reports stay accurate forever; only future days stop generating.
  2. Soft-delete the rule — keep the rule in storage but mark it inactive/archived so it stops generating new future days and disappears from the Schedule tab's rule slot, but stays around so past billing keeps deriving from it correctly. No new rotation blocks created.

Trade-offs to weigh: data model growth (rotation blocks) vs. a new "archived rule" concept; how "elapsed" is defined (as of deletion instant, vs. as of the exact moment stats are viewed); migration for existing installs; interaction with the single-rule constraint (issue #30) and OnCallStore.deleteRule's exception-scoping (from #35/PR #37).

Related: #30 (single-rule constraint), #35 (deleteRule exception scoping).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions