fix: Aufteilung – Tabelle volle Breite, Torte darunter; ungültige Eingaben inline (A13-T5)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -392,7 +392,7 @@ def _parse_monat(value: str | None, today: date) -> date | None:
|
||||
if not value:
|
||||
return today.replace(day=1)
|
||||
m = re.fullmatch(r"(\d{4})-(\d{2})", value.strip())
|
||||
if not m or not 1 <= int(m.group(2)) <= 12:
|
||||
if not m or not 1 <= int(m.group(2)) <= 12 or int(m.group(1)) < 1:
|
||||
return None
|
||||
return date(int(m.group(1)), int(m.group(2)), 1)
|
||||
|
||||
@@ -429,7 +429,7 @@ def _aufteilung_context(session: Session, today: date, monat: str | None,
|
||||
ctx["monat_anzeige"] = month.strftime("%m.%Y")
|
||||
scenario = None
|
||||
if szenario:
|
||||
valid_id = szenario.isdigit() and len(szenario) <= 9 # kein Integer-Überlauf in der DB
|
||||
valid_id = re.fullmatch(r"[0-9]{1,9}", szenario) # ASCII, kein Integer-Überlauf
|
||||
scenario = session.get(Scenario, int(szenario)) if valid_id else None
|
||||
if scenario is None:
|
||||
ctx["error"] = "Unbekanntes Szenario – bitte neu wählen."
|
||||
|
||||
Reference in New Issue
Block a user