mirror of
https://github.com/complexcaresolutions/dak.c2s.git
synced 2026-03-17 20:43:41 +00:00
fix: wrap vorjahr data in "summary" key to match excel_export structure
get_vorjahr_summary returned a flat dict, but excel_export looked for
data under vj.get("summary", {}), resulting in empty Vorjahr columns.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8502c7a7fb
commit
9d79ba35bc
1 changed files with 7 additions and 4 deletions
|
|
@ -97,9 +97,12 @@ def refresh_vorjahr_cache(db: Session, jahr: int) -> int:
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
def _aggregate_summaries(jahr: int, summaries: list[YearlySummary]) -> dict:
|
def _aggregate_summaries(jahr: int, summaries: list[YearlySummary]) -> dict:
|
||||||
"""Sum up weekly YearlySummary rows into yearly totals."""
|
"""Sum up weekly YearlySummary rows into yearly totals.
|
||||||
result = {
|
|
||||||
"jahr": jahr,
|
Returns a dict with a ``summary`` key so that excel_export can access
|
||||||
|
it the same way as the current-year sheet1 data (``data.get("summary")``).
|
||||||
|
"""
|
||||||
|
totals = {
|
||||||
"erstberatungen": sum(_safe(s.erstberatungen) for s in summaries),
|
"erstberatungen": sum(_safe(s.erstberatungen) for s in summaries),
|
||||||
"ablehnungen": sum(_safe(s.ablehnungen) for s in summaries),
|
"ablehnungen": sum(_safe(s.ablehnungen) for s in summaries),
|
||||||
"unterlagen": sum(_safe(s.unterlagen) for s in summaries),
|
"unterlagen": sum(_safe(s.unterlagen) for s in summaries),
|
||||||
|
|
@ -108,7 +111,7 @@ def _aggregate_summaries(jahr: int, summaries: list[YearlySummary]) -> dict:
|
||||||
"gutachten_alternative": sum(_safe(s.gutachten_alternative) for s in summaries),
|
"gutachten_alternative": sum(_safe(s.gutachten_alternative) for s in summaries),
|
||||||
"gutachten_bestaetigung": sum(_safe(s.gutachten_bestaetigung) for s in summaries),
|
"gutachten_bestaetigung": sum(_safe(s.gutachten_bestaetigung) for s in summaries),
|
||||||
}
|
}
|
||||||
return result
|
return {"jahr": jahr, "summary": totals}
|
||||||
|
|
||||||
|
|
||||||
def _calculate_and_cache(db: Session, jahr: int) -> dict:
|
def _calculate_and_cache(db: Session, jahr: int) -> dict:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue