Add number of further districts

This commit is contained in:
Felix Blanke 2023-09-13 16:26:51 +02:00
parent 3953d6d2ff
commit 14e314822d

11
wsgi.py
View File

@ -291,6 +291,7 @@ def _print_as_html(
dropna: bool = True,
) -> list[str]:
df = df.astype({"Digitale Befragung": "Int32"})
num_missing = (df[df.isna().any(axis=1)]["Landesbezirk"] != "Hessen").sum()
if dropna:
df = df.dropna()
with pd.option_context("display.max_rows", None):
@ -315,11 +316,11 @@ def _print_as_html(
]
)
if total and (diff := total - df["Digitale Befragung"].sum()):
tfoot.extend(
[
" <tr>",
" <td>Weitere Bezirke</td>",
]
tfoot.append(" <tr>")
tfoot.append(
f" <td>Weitere Bezirke ({num_missing})</td>"
if num_missing
else f" <td>Weitere Bezirke</td>"
)
for i in range(len(df.columns) - 2):
tfoot.append(" <td></td>")