feat(workflows): Update CI configuration and enhance testing conditions
Deploy Development / deploy (push) Successful in 48s
Build Test / pytest-backend-csv (push) Failing after 24s
Build Test / lint-backend (push) Failing after 3s
Build Test / build-frontend (push) Successful in 1m25s

- Added workflow_run triggers for "Deploy Development" and "Deploy Production" to ensure tests run only after successful deployments.
- Updated Python version in CI from 3.12 to 3.11 for better compatibility with the Debian 12 ARM64 runner.
- Enhanced job conditions to skip tests on failed workflow runs.
- Improved frontend build process by updating Node.js setup and ensuring correct directory navigation.
- Refined CSV parsing logic to handle custom and unknown source units, enhancing conversion flexibility.
- Added new tests for custom source unit handling in CSV conversions, ensuring accurate processing.
This commit is contained in:
Lars committed 2026-04-10 10:27:59 +02:00
1 parent d6d7e738a5
commit 0d0ab62674
5 files changed
+53 -9

No files matched your search

+5
View File
@@ -83,12 +83,17 @@ def factor_source_to_canonical(module: str, db_field: str, source_unit: str | No
"""
Multiplikator: CSV-Zahl * Faktor → Wert in kanonischer DB-Einheit.
Unbekannte/None/leer/Passthrough → 1.0
``source_unit`` ``custom`` / ``none``: kein Registry-Faktor (1.0); freie Skalierung nur über
``conversion_factor`` in type_conversions (JSON).
"""
if source_unit is None:
return 1.0
su = str(source_unit).strip().lower()
if not su:
return 1.0
if su in ("custom", "none"):
return 1.0
cu = get_canonical_unit(module, db_field)
if not cu:
return 1.0
+6 -3
View File
@@ -312,8 +312,11 @@ def convert_value(
- decimal_separator: ".", ",", "auto" — bei auto Heuristik EU/US-Mischformen.
- formats: [ "yyyy-mm-dd", "%d.%m.%y", ... ] — weitere strptime-/Alias-Ketten.
- dayfirst: true|false — nur für dateutil-Fallback; Standard: true dann false.
- source_unit: z. B. "kj", "kg" — Quelleinheit; Ziel aus Modul-Feld (unit in module_registry);
Faktor wird serverseitig ermittelt. Optional zusätzlich conversion_factor (legacy/zusätzlich).
- source_unit: Registry-IDs (z. B. "kj", "kg") oder "custom"/"none" — letztere ohne
vordefinierten Faktor; beliebige Skalierung dann nur über conversion_factor.
- conversion_factor: Zusätzlicher Multiplikator nach dem Parsen (und nach source_unit);
für nicht vordefinierte Umrechnungen source_unit weglassen oder "custom" setzen und
hier den Faktor angeben.
"""
if spec is None:
return raw.strip() if raw else None
@@ -331,7 +334,7 @@ def convert_value(
v = _float_from_spec(raw, spec)
if module:
su = spec.get("source_unit")
if su is not None:
if su is not None and str(su).strip() != "":
v = float(v) * factor_source_to_canonical(module, db_field, str(su))
factor = spec.get("conversion_factor")
if factor is not None: