Aufraeumen: Audit-Filter aus dem Protokoll, Reorganisation entfernt, toter Code
- Audit-Log: die Auswahl der Aktionen kommt aus dem Protokoll selbst (distinct action) statt aus einer festen Liste, die vier tote Aktionen fuehrte und rund dreissig aktuelle nicht kannte. - "Reorganisation" nicht mehr als Ereignistyp in den Berichten (immer leer) und nicht im Import; Texte in Organigramm, Nachtlauf (nachtlauf.ps1) und Kommentaren ohne Reorg. Import kennt "Uebernahme", nicht mehr "Gehaltsanpassung". - adjust_karenz_return entfernt (Migration): sie setzte nur die Spalte und liess die vorgemerkte Rueckkehr stehen; rueckkehr_anpassen ist der Weg. lib/acting-manager.ts entfernt (die Berichtslinie rechnet om_reporting_lines in der Datenbank). - Export Mitarbeiter: "Auf wessen Wunsch" mit "Wunsch Dienstnehmer/ Dienstgeber" wie in der Oberflaeche. Geprueft: lint, tsc, types:check, Tests, Uebergabe-Waechter
This commit is contained in:
@@ -1,62 +0,0 @@
|
||||
// Who actually leads a team while its lead is on a long-term absence.
|
||||
//
|
||||
// The rule: reporting rolls up to the next management level, and keeps
|
||||
// rolling up until it reaches somebody who is present. Someone on
|
||||
// Langzeitabwesenheit stays formally in charge — nothing is written to
|
||||
// employees.manager_id — so this is derived at read time and the stand-in is
|
||||
// always shown as such rather than silently replacing the real manager.
|
||||
|
||||
export type ChainNode = {
|
||||
id: string;
|
||||
/** The recorded manager, absent or not. */
|
||||
managerId: string | null;
|
||||
absent: boolean;
|
||||
};
|
||||
|
||||
export type ActingManagerResult = {
|
||||
/** Who to report to in practice — the nearest present manager. */
|
||||
actingManagerId: string | null;
|
||||
/**
|
||||
* The recorded manager, when they differ from the acting one. Null when
|
||||
* nobody is standing in, so the UI can show the arrangement only when
|
||||
* there is one.
|
||||
*/
|
||||
coveredForId: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Walks up from `node`'s recorded manager until it finds one who is present.
|
||||
*
|
||||
* Falls back to the recorded manager when the whole chain above is absent
|
||||
* (or leads nowhere): re-rooting a team to the top of the chart would be a
|
||||
* bigger lie than showing the absent manager, and the absence is labelled
|
||||
* either way.
|
||||
*/
|
||||
export function resolveActingManager(node: ChainNode, byId: Map<string, ChainNode>): ActingManagerResult {
|
||||
const formalId = node.managerId;
|
||||
if (!formalId) return { actingManagerId: null, coveredForId: null };
|
||||
|
||||
const formal = byId.get(formalId);
|
||||
if (!formal || !formal.absent) return { actingManagerId: formalId, coveredForId: null };
|
||||
|
||||
// Nothing in the schema forbids a manager_id cycle, so the walk has to
|
||||
// terminate on its own rather than trusting the data.
|
||||
const seen = new Set<string>([node.id, formalId]);
|
||||
let current: ChainNode | undefined = formal;
|
||||
|
||||
while (current?.managerId && !seen.has(current.managerId)) {
|
||||
seen.add(current.managerId);
|
||||
const next = byId.get(current.managerId);
|
||||
if (!next) break;
|
||||
if (!next.absent) return { actingManagerId: next.id, coveredForId: formalId };
|
||||
current = next;
|
||||
}
|
||||
|
||||
return { actingManagerId: formalId, coveredForId: null };
|
||||
}
|
||||
|
||||
/** Applies the walk to a whole set, returning one result per node id. */
|
||||
export function resolveActingManagers(nodes: ChainNode[]): Map<string, ActingManagerResult> {
|
||||
const byId = new Map(nodes.map((n) => [n.id, n]));
|
||||
return new Map(nodes.map((n) => [n.id, resolveActingManager(n, byId)]));
|
||||
}
|
||||
@@ -57,9 +57,8 @@ const EREIGNIS = [
|
||||
"Stammdatenänderung",
|
||||
"Austritt",
|
||||
"Wiedereintritt",
|
||||
"Reorganisation",
|
||||
"Gehaltsanpassung",
|
||||
"Rückkehr",
|
||||
"Übernahme",
|
||||
] as const;
|
||||
|
||||
export const BLATT_STANDORTE: BlattSchema = {
|
||||
|
||||
@@ -502,10 +502,12 @@ export const EVENT_TYPE_LABELS: Record<HistoryEventType, string> = {
|
||||
// * „Stammdatenänderung" entsteht bei jeder geänderten Telefonnummer.
|
||||
// * „Gehaltsanpassung" ist ein totes Ereignis: das Gehalt liegt in Loga,
|
||||
// keine SQL-Funktion schreibt diesen Typ.
|
||||
// * „Reorganisation" ebenso: eine Umorganisation gibt es als Vorgang
|
||||
// nicht, der Wert steht nur im Aufzählungstyp.
|
||||
//
|
||||
// „Wiedereintritt" gehört dagegen hierher und bekommt in
|
||||
// lib/colors.ts dieselbe grüne Kategorie wie der Eintritt — es ist einer.
|
||||
const NICHT_AUSWERTBAR: readonly HistoryEventType[] = ["Stammdatenänderung", "Gehaltsanpassung"];
|
||||
const NICHT_AUSWERTBAR: readonly HistoryEventType[] = ["Stammdatenänderung", "Gehaltsanpassung", "Reorganisation"];
|
||||
|
||||
export const EREIGNIS_AUSWAHL: readonly HistoryEventType[] = (
|
||||
Object.keys(EVENT_TYPE_LABELS) as HistoryEventType[]
|
||||
|
||||
@@ -879,7 +879,6 @@ export type Database = {
|
||||
transfer_employee: { Args: { payload: Record<string, unknown> }; Returns: void };
|
||||
promote_employee: { Args: { payload: Record<string, unknown> }; Returns: void };
|
||||
start_karenz: { Args: { payload: Record<string, unknown> }; Returns: void };
|
||||
adjust_karenz_return: { Args: { payload: Record<string, unknown> }; Returns: void };
|
||||
record_karenz_return: { Args: { payload: Record<string, unknown> }; Returns: void };
|
||||
rueckkehr_anpassen: { Args: { payload: Record<string, unknown> }; Returns: void };
|
||||
change_employee_data: { Args: { payload: Record<string, unknown> }; Returns: void };
|
||||
|
||||
Reference in New Issue
Block a user