fix(csv-import): Normalize source unit representation and update CI workflows
Deploy Development / deploy (push) Successful in 49s
Build Test / pytest-backend (push) Failing after 3s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 17s

- Changed source unit representation from "kJ" to "kj" for consistency across CSV templates and migrations.
- Updated CI workflow to enhance testing conditions, ensuring tests run in the correct environment based on deployment context.
- Improved job steps for backend testing and syntax checking by utilizing deployed application directories, streamlining the CI process.
This commit is contained in:
Lars committed 2026-04-10 10:42:59 +02:00
1 parent 0d0ab62674
commit bb6eefc837
5 files changed
+91 -39

No files matched your search

@@ -31,9 +31,7 @@ SELECT
},
"kcal": {
"type": "float",
"source_unit": "kJ",
"target_unit": "kcal",
"conversion_factor": 0.239,
"source_unit": "kj",
"decimal_separator": ","
},
"fat_g": {"type": "float", "decimal_separator": ","},
@@ -0,0 +1,19 @@
-- Migration 046: FDDB-Systemvorlage — kcal ohne legacy conversion_factor/target_unit (Issue #21, source_unit-Registry)
-- Doppelte Umrechnung (kj-Faktor * 0.239) wurde fälschlich gespeichert; target_unit ist nur für duration vorgesehen.
UPDATE csv_field_mappings
SET type_conversions = jsonb_set(
type_conversions,
'{kcal}',
((type_conversions->'kcal') - 'conversion_factor' - 'target_unit')
|| jsonb_build_object('source_unit', 'kj')
)
WHERE is_system = true
AND profile_id IS NULL
AND module = 'nutrition'
AND mapping_name = 'FDDB Export (Standard)'
AND (type_conversions->'kcal') IS NOT NULL
AND (
(type_conversions->'kcal') ? 'conversion_factor'
OR (type_conversions->'kcal') ? 'target_unit'
);