Additional bugfixes
All checks were successful
CI / test (push) Successful in 50s
CI / test-analytics (push) Successful in 1m57s
CI / build-api (push) Successful in 3m26s
CI / build-frontend (push) Successful in 2m11s
CI / build-analytics (push) Successful in 2m46s

This commit is contained in:
2026-06-27 14:00:59 +02:00
parent b1de6284f7
commit 980233840e
4 changed files with 34 additions and 35 deletions

View File

@@ -23,5 +23,5 @@ def get_executor() -> ThreadPoolExecutor:
def shutdown_executor() -> None:
global _executor
if _executor is not None:
_executor.shutdown(wait=False)
_executor.shutdown(wait=True)
_executor = None

View File

@@ -2,6 +2,7 @@ from __future__ import annotations
import io
import openpyxl
from reportlab.lib import colors
from reportlab.lib.pagesizes import A4, landscape
from reportlab.lib.styles import getSampleStyleSheet
@@ -57,6 +58,19 @@ def _pdf_table(rows: list[dict]) -> Table:
return t
def to_xlsx_bytes(rows: list[dict]) -> bytes:
"""Serialise *rows* to a single-sheet XLSX workbook and return the raw bytes."""
wb = openpyxl.Workbook()
ws = wb.active
if rows:
ws.append(list(rows[0].keys()))
for row in rows:
ws.append([str(v) if v is not None else "" for v in row.values()])
buf = io.BytesIO()
wb.save(buf)
return buf.getvalue()
def to_pdf_bytes(rows: list[dict], title: str, subtitle: str = "") -> bytes:
"""Serialise *rows* to a single-sheet PDF and return the raw bytes."""
buf = io.BytesIO()