Lehrling, and a field that stops being named after its values
Some checks failed
CI / Lint, Typen, Tests, Build (push) Successful in 10m51s
CI / Migrationen auf leerer Datenbank (push) Has been cancelled

worker_type had two values because the field was named after them:
"Angestellte:r / Arbeiter:in". Lehrlinge are the third social-insurance
category in Austria; until now they were filed as one of the other two,
which they are not -- and which skewed every report grouped by this
column by exactly those people.

Adding the value is one line. The label was the work: the field was
called after its two values in six places, and each of them becomes
wrong with a third. They now read "Beschaeftigtengruppe", the name the
import has used all along.

One label deliberately keeps the old wording: app_feld_karte() in the
database. That string is not a caption there but a key -- stored rows in
employee_history and pending_changes carry it, and the map is how
reverting or correcting a history entry finds the field again. Renaming
it without rewriting those rows would make every older entry for this
field unrevertable, and nobody would notice until they tried.

The migration's assertion reads pg_enum rather than comparing against
'Lehrling'::worker_type: migrations run inside a transaction, and
Postgres refuses to use a freshly added enum value in the transaction
that added it. This has not been run against a live database here -- the
CI migration job is the first real execution.

Three hand-kept lists of the same enum (reports, import, the form) now
have a test holding them to one another, each mutation-checked.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-10 17:28:49 +02:00
parent 2838919e42
commit f17d299045
12 changed files with 193 additions and 9 deletions

View File

@@ -342,7 +342,7 @@ export const BLATT_PERSONEN: BlattSchema = {
name: "Beschäftigtengruppe",
ziel: "worker_type",
pflicht: false,
typ: { art: "auswahl", werte: ["Angestellte:r", "Arbeiter:in"] },
typ: { art: "auswahl", werte: ["Angestellte:r", "Arbeiter:in", "Lehrling"] },
hinweis: "Leer = Angestellte:r.",
beispiel: "Angestellte:r",
},

View File

@@ -43,7 +43,7 @@ function werte(...w: string[]): { wert: string; label: string }[] {
export const AUSWAHL_KRITERIEN: readonly AuswahlKriterium[] = [
{ key: "employment", label: "Beschäftigungsart", alle: "Alle Beschäftigungsarten", optionen: werte("Vollzeit", "Teilzeit") },
{ key: "contract", label: "Vertragsart", alle: "Alle Vertragsarten", optionen: werte("unbefristet", "befristet") },
{ key: "worker", label: "Angestellte:r / Arbeiter:in", alle: "Alle", optionen: werte("Angestellte:r", "Arbeiter:in") },
{ key: "worker", label: "Beschäftigtengruppe", alle: "Alle", optionen: werte("Angestellte:r", "Arbeiter:in", "Lehrling") },
{ key: "kv", label: "Kollektivvertrag", alle: "Alle Kollektivverträge", optionen: werte("Handel", "Süßwaren") },
{ key: "paygrade", label: "Paygrade", alle: "Alle Paygrades", optionen: werte("A", "B", "C", "D", "E", "F") },
{ key: "source", label: "Intern/Extern", alle: "Alle", optionen: werte("Intern", "Extern") },

View File

@@ -49,7 +49,7 @@ export const GROUP_LABELS: Record<GroupDimension, string> = {
entry_year: "Eintrittsjahr",
source: "Intern/Extern",
paygrade: "Paygrade",
worker_type: "Angestellte:r / Arbeiter:in",
worker_type: "Beschäftigtengruppe",
collective_agreement: "Kollektivvertrag",
betriebsrat: "Betriebsrat",
dienstwagen: "Dienstwagen",

View File

@@ -9,7 +9,15 @@ export type ContractType = "unbefristet" | "befristet";
export type PaygradeType = "A" | "B" | "C" | "D" | "E" | "F";
export type SourceType = "Intern" | "Extern";
export type GenderType = "m" | "w";
export type WorkerType = "Angestellte:r" | "Arbeiter:in";
/**
* Die sozialversicherungsrechtliche Beschäftigtengruppe.
*
* Lehrling steht seit September 2026 daneben (Migration 20260910140000).
* Bis dahin wurden Lehrlinge als Angestellte:r oder Arbeiter:in geführt,
* was sie nicht sind — und was jede Auswertung nach dieser Spalte um
* genau diese Personen verfälschte.
*/
export type WorkerType = "Angestellte:r" | "Arbeiter:in" | "Lehrling";
export type CollectiveAgreement = "Handel" | "Süßwaren";
export type Weekday = "Mo" | "Di" | "Mi" | "Do" | "Fr" | "Sa" | "So";