Move the part-time arrangements out of the absence list
Bildungsteilzeit, Elternteilzeit, Pflegeteilzeit and Wiedereingliederungsteilzeit were offered as kinds of long-term absence. Recorded that way, the person counted as absent: they dropped out of headcount, their reporting line fell to a stand-in, and reports stopped counting them — while they were in the building every week, just for fewer hours. A part-time arrangement is not an absence; it is a change of hours. They now sit where they belong. Wiedereingliederungs- and Elternteilzeit appear when recording a return from absence, as the reason someone comes back on reduced hours — both typically begin exactly when the absence ends. Bildungs- and Pflegeteilzeit appear under "Daten ändern" beside the hours, next to the ordinary contractual change. The reason is recorded with the change, not as a state on the person. A state would have to be maintained, and nobody goes back to note when a Bildungsteilzeit ended; a field that quietly goes stale is worse than none. In the history it stands next to the value it explains, and stays readable for good. The check constraint on absence_type is deliberately untouched. Three people carry the old values right now — two Pflegeteilzeit, one Wiedereingliederungsteilzeit. Forbidding them would make existing rows illegal. They are gone from the list of choices; the history stays readable. Those three are worth revisiting, but that is a data decision, not a code one. Rehearsed against real data: an hours change with a reason and one without, a reduced return with a reason and an unchanged one — checked by reading both new history rows rather than "the latest", since now() stands still inside a transaction and made an earlier probe report a false negative. I also overwrote tests/unit/absence.test.ts instead of extending it. The original cases are restored; the diff is 49 added lines and 3 changed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,18 +7,24 @@ import type { EmploymentStatus } from "./supabase/types";
|
||||
// a label change (see supabase/migrations/*_absence_type.sql). So the value
|
||||
// is mapped to its display name here, in the one place the UI reads it from.
|
||||
|
||||
// Nur echte Abwesenheiten. Eine Teilzeit ist keine: wer in Bildungs-,
|
||||
// Pflege-, Eltern- oder Wiedereingliederungsteilzeit ist, arbeitet — nur
|
||||
// weniger. Als „Langzeitabwesenheit" geführt, verschwand die Person aus dem
|
||||
// Bestand, verlor ihre Berichtslinie an eine Vertretung und zählte in
|
||||
// Auswertungen nicht mehr mit, obwohl sie jede Woche im Haus war.
|
||||
//
|
||||
// Die vier sind deshalb hierher gewandert, wo sie hingehören: zur
|
||||
// Stundenänderung (siehe STUNDEN_GRUENDE) und zur Rückkehr aus einer
|
||||
// Abwesenheit (RUECKKEHR_GRUENDE).
|
||||
export const ABSENCE_TYPES = [
|
||||
"Wochenhilfe (Mutterschutz)",
|
||||
"Elternkarenz (inkl. Väterkarenz)",
|
||||
"Papamonat",
|
||||
"Bildungskarenz",
|
||||
"Bildungsteilzeit",
|
||||
"Präsenzdienst",
|
||||
"Zivildienst",
|
||||
"Langer Krankenstand",
|
||||
"Wiedereingliederungsteilzeit",
|
||||
"Pflegekarenz",
|
||||
"Pflegeteilzeit",
|
||||
"Familienhospizkarenz",
|
||||
"Sabbatical",
|
||||
] as const;
|
||||
@@ -29,6 +35,25 @@ export function isAbsenceType(value: string | null | undefined): value is Absenc
|
||||
return ABSENCE_TYPES.includes(value as AbsenceType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Warum jemand nach einer Abwesenheit mit weniger Stunden zurückkommt.
|
||||
*
|
||||
* Beides sind Ansprüche, keine freien Vereinbarungen — und beide beginnen
|
||||
* typischerweise genau dann, wenn die Abwesenheit endet.
|
||||
*/
|
||||
export const RUECKKEHR_GRUENDE = ["Wiedereingliederungsteilzeit", "Elternteilzeit"] as const;
|
||||
|
||||
/**
|
||||
* Warum sich die Wochenstunden ändern.
|
||||
*
|
||||
* Der erste Wert ist der Normalfall; die beiden anderen sind gesetzlich
|
||||
* geregelte Teilzeiten, die man später wiederfinden können muss — im
|
||||
* Zweifel Jahre danach, wenn jemand fragt, warum die Stunden damals sanken.
|
||||
*/
|
||||
export const STUNDEN_GRUENDE = ["Vertragliche Stundenänderung", "Bildungsteilzeit", "Pflegeteilzeit"] as const;
|
||||
|
||||
export type StundenGrund = (typeof STUNDEN_GRUENDE)[number];
|
||||
|
||||
/** Display names for the stored status values. */
|
||||
const STATUS_LABELS: Record<EmploymentStatus, string> = {
|
||||
Aktiv: "Aktiv",
|
||||
|
||||
Reference in New Issue
Block a user