Skip to content

Simplify work schedules: current + at most one future schedule, history read-only #82

Open

Description

@WagnerLuca

Problem

Work schedules ("Arbeitszeitmodell") are a list of periods with from/to dates that members and admins edit freely. That is hard to understand and easy to get wrong (gaps, overlaps, accidental retroactive changes).

Decision (2026-10-27)

  • There is the current schedule and at most one future one ("Ab 01.12.2026"). From its start day the future one becomes the current one automatically.
  • Changing the schedule never rewrites the past: "Ändern" always creates the next period with a start date (default today; the earliest allowed is today for members, any open day for admins). If a future one exists, changing replaces it (confirm).
  • Admins can still correct the current period retroactively (typos), but never into closed months (the closed-period guard / frozen months apply).
  • Past periods stay in the data (they define past target hours) and are shown only as a collapsed, read-only "Verlauf".

Acceptance criteria

Backend

  • The API exposes current, future (nullable) and history (read-only) per member and org; a create/change endpoint takes {validFrom, targets…} and: closes the current period the day before validFrom, replaces an existing future period, rejects a second future period, rejects validFrom in a closed month (members also before today). Explicit "correct current" endpoint for admins (same validation as today's update, guard applies). Deleting only the future period (members, if allowed by their rule) — past/current periods can't be deleted (admins: only by correction).
  • Data migration: existing periods are normalised — overlaps/gaps resolved deterministically (document the rule), open-ended last period = current or future depending on its start; more than one future period → keep the earliest, log/report the others (count in the migration output). Nothing in closed months changes (verify in a test).
  • Schedule-change requests (RequestType.WorkScheduleChange) follow the same model (request = "new schedule from date"); approval applies it through the same code.
  • Rule modes (Disabled/RequiresApproval/Allowed, group overrides) keep working; initial overtime unaffected.
  • Remove now-unused endpoints/fields (clearValidTo, free period editing) or keep them admin-only with a clear reason; regenerate the API client.

UI

  • "Mein Arbeitszeitmodell" and the member page show one card: current targets (week view Mo–So, weekly total), an "Ab " card for the future one (with cancel), a button "Ändern ab …", and a collapsed read-only "Verlauf". Admins additionally "Aktuelles korrigieren" (with the closed-month hint).
  • The form defaults to the current values, start date default today, "gleichmäßig verteilen (Mo–Fr)" stays, weekend fields stay.
  • Onboarding checklist / dashboard hints still work (schedule set or not).
  • German + English, 390 px.

Tests

  • Backend: change from today/future date, replace future, second future rejected, closed-month start rejected, member before today rejected, admin correction blocked in closed months, future becomes current on its day (target hours of that day), migration normalisation (overlaps, gaps, several futures), requests flow, frozen closed months unaffected (Freeze closed months: figures of closed months never change afterwards #81).
  • Frontend unit + e2e: change from a date, cancel future, history shows the old period, admin correction.

Activity

  1. added
    enhancement
    on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions