feat: Szenario-Eintraege als eine editierbare Tabelle

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-20 12:51:04 +02:00
parent 4843f2e130
commit cb44194daf
4 changed files with 197 additions and 102 deletions

View File

@@ -354,6 +354,36 @@ def test_szenario_gui_ende_und_einmalzahlungen(client, db):
assert 'value="ende"' in r # neue Art im Dropdown
assert 'name="end_date"' in r # Datumsfeld im Modifikator-Formular
assert "31.08.2026" in r # ende-Modifikator zeigt Datum
assert "Einmalzahlungen in diesem Szenario" in r
assert "Einträge" in r
assert f'data-planned-url="/api/scenarios/{sc.id}/planned"' in r
assert "Zufluss-GUI" in r and "5.000,00" in r and "30.07.2026" in r
assert f'hx-post="/api/scenarios/{sc.id}/planned"' in r
def test_szenario_eintraege_tabelle(client, db):
client.post("/login", data={"username": "admin", "password": "geheim"})
sc = Scenario(name="Eintraege-GUI", description="")
db.add(sc)
db.flush()
db.add(ScenarioModifier(scenario_id=sc.id, target_type="recurring",
target_id=1, kind="ende", value=Decimal("0"),
end_date=date(2026, 8, 31)))
db.add(ScenarioModifier(scenario_id=sc.id, target_type="category",
target_id=1, kind="percent", value=Decimal("25.00")))
db.add(ScenarioPlannedItem(scenario_id=sc.id, name="Zufluss-Eintrag",
amount=Decimal("5000.00"), due=date(2026, 7, 30)))
db.commit()
r = client.get("/planung").text
assert "Einträge" in r
# alte details-Abschnitte sind ersetzt
assert "<summary>Modifikatoren</summary>" not in r
assert "Einmalzahlungen in diesem Szenario" not in r
# gemischte Zeilen in EINER Tabelle
assert "31.08.2026" in r and "25,00" in r and "Zufluss-Eintrag" in r
assert ">Einmalzahlung<" in r
# Inline-Edit je Typ
assert f'hx-patch="/api/scenarios/{sc.id}/modifiers/' in r
assert f'hx-patch="/api/scenarios/{sc.id}/planned/' in r
# Anlege-Formular: Eintragsart inkl. Einmalzahlung + Endpunkt-Wechsel-Attribute
assert 'value="einmal"' in r
assert f'data-planned-url="/api/scenarios/{sc.id}/planned"' in r
assert "onEntryArtChange" in r and "onModKindChange" not in r