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:
@@ -206,4 +206,16 @@ describe.skipIf(!url)("Übernahme aus V70 über die API", () => {
|
||||
expect(t2.ueberschneidungen).toEqual([expect.objectContaining({ name: "Henning Schaarschmidt", ab: a.anfang })]);
|
||||
expect(t2.besetzungen.map((x: { kurz: string }) => x.kurz).sort()).toEqual(["HS", "HS", "Meier"]);
|
||||
});
|
||||
|
||||
it("Startseite: Aufgaben, Warnungen und wer macht was", async () => {
|
||||
await app.inject({ method: "POST", url: "/api/aufgaben", payload: { text: "Statik anfragen", faellig_am: "2026-10-16" } });
|
||||
const t = (await app.inject("/api/terminplan")).json();
|
||||
const u = (await app.inject(`/api/uebersicht?heute=${t.ueberschneidungen[0].ab}`)).json();
|
||||
expect(u.aufgaben.ueberfaellig.map((a: { text: string }) => a.text)).toContain("Statik anfragen");
|
||||
const arten = u.warnungen.map((w: { art: string }) => w.art);
|
||||
expect(arten).toEqual(expect.arrayContaining(["aufgabe", "kontostand"]));
|
||||
expect(u.warnungen.find((w: { art: string }) => w.art === "kontostand").text).toMatch(/nicht eingetragen/);
|
||||
expect(u.einsatz.tage).toHaveLength(8);
|
||||
expect(u.einsatz.zeilen.map((z: { anzeige: string }) => z.anzeige)).toContain("Henning Schaarschmidt");
|
||||
});
|
||||
});
|
||||
|
||||
32
test/uebersicht.test.ts
Normal file
32
test/uebersicht.test.ts
Normal 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]);
|
||||
});
|
||||
});
|
||||
@@ -125,3 +125,19 @@ describe("Liquidität centgenau wie V70", () => {
|
||||
expect([...projekte(mit)].filter((p) => !projekte(ohne).has(p)).sort()).toEqual(["A-27-001", "A-OHNE-1"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Aufgaben aus V70 (Stufe 1)", () => {
|
||||
it("übernimmt Text, Datum, Kontakt, Projekt und Erledigt", () => {
|
||||
const s = JSON.parse(readFileSync(new URL("./daten/v70-sicherung-2026-10-19.json", import.meta.url), "utf8"));
|
||||
s.aufgaben = [
|
||||
{ id: "a1", t: "Statik anfragen", d: "2026-10-22", k: "Ing.-Büro Lange", p: 0 },
|
||||
{ id: "a2", t: "Gerüst abbestellen", done: true, doneAt: Date.UTC(2026, 9, 1) },
|
||||
{ id: "a3", t: " " },
|
||||
];
|
||||
const u = uebernimmV70(s);
|
||||
expect(u.aufgaben).toEqual([
|
||||
{ text: "Statik anfragen (Ing.-Büro Lange)", faellig_am: "2026-10-22", projekt: "p0", erledigt_am: undefined },
|
||||
{ text: "Gerüst abbestellen", faellig_am: undefined, projekt: undefined, erledigt_am: "2026-10-01T00:00:00.000Z" },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user