Startseite mit Aufgaben, Warnungen und wer macht was; Aufgaben aus V70 übernehmen

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmyPfuNc4sCRfaF3oURXZz
This commit is contained in:
Claude
2026-10-19 19:01:50 +00:00
parent aedd86a29b
commit 8a4fbafa65
10 changed files with 363 additions and 17 deletions

32
test/uebersicht.test.ts Normal file
View File

@@ -0,0 +1,32 @@
import { describe, expect, it } from "vitest";
import { aufgabenGruppen, einsatzMatrix, naechsteArbeitstage } from "../src/domain/uebersicht.js";
import { STANDARDWOCHE as W } from "../src/domain/kalender.js";
describe("Aufgaben wie in V70 gruppiert", () => {
const a = (id: string, faellig_am: string | null, extra = {}) => ({ id, text: id, faellig_am, ...extra });
it("überfällig, diese Woche bis Sonntag, langfristig; erledigte fallen weg", () => {
// Mittwoch, 21.10.2026
const g = aufgabenGruppen([a("alt", "2026-10-20"), a("so", "2026-10-25"), a("mo", "2026-10-26"), a("ohne", null), a("fertig", "2026-10-21", { erledigt_am: "x" }), a("lang", "2026-10-22", { langfristig: true })], "2026-10-21");
expect(g.ueberfaellig.map((x) => x.id)).toEqual(["alt"]);
expect(g.dieseWoche.map((x) => x.id)).toEqual(["so"]);
expect(g.langfristig.map((x) => x.id)).toEqual(["lang", "mo", "ohne"]);
});
});
describe("Wer macht was", () => {
it("nächste Arbeitstage ohne Freitag und Feiertag", () => {
expect(naechsteArbeitstage("2026-10-29", 3, W)).toEqual(["2026-10-29", "2026-11-02", "2026-11-03"]);
});
it("Person je Zeile, Vorgänge ohne Besetzung extra", () => {
const tage = ["2026-10-19", "2026-10-20", "2026-10-21"];
const vg = [
{ id: "v1", name: "Abbund", anfang: "2026-10-19", ende: "2026-10-20", projekt: "P-26-014 Bohlentausch" },
{ id: "v2", name: "Montage", anfang: "2026-10-21", ende: "2026-10-22", projekt: "P-26-015 Anbau" },
];
const bs = [{ vorgang_id: "v1", kontakt_id: "k1", personen: 1, freigegeben: true, anzeige: "Henning", kurz: "HS" }];
const m = einsatzMatrix(vg, bs, tage);
expect(m.zeilen).toHaveLength(1);
expect(m.zeilen[0]!.tage.map((t) => t.map((x) => x.name))).toEqual([["Abbund"], ["Abbund"], []]);
expect(m.ohne.tage.map((t) => t.length)).toEqual([0, 0, 1]);
});
});