fix(csv-import): Normalize source unit representation and update CI workflows
- 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:
1 parent
0d0ab62674
commit
bb6eefc837
5 files changed
+91
-39
No files matched your search
@@ -182,7 +182,11 @@ export default function AdminCsvTemplateEditorPage() {
|
||||
const opts = modMeta?.fields?.[fieldKey]?.source_unit_options || []
|
||||
const canonical = opts.find((o) => o.is_canonical)?.id || opts[0]?.id
|
||||
const su = tc[fieldKey]?.source_unit
|
||||
if (su && opts.some((o) => o.id === su)) return su
|
||||
if (su != null && su !== '') {
|
||||
const sid = String(su).toLowerCase()
|
||||
const hit = opts.find((o) => o.id === sid)
|
||||
if (hit) return hit.id
|
||||
}
|
||||
return canonical || ''
|
||||
}
|
||||
|
||||
@@ -205,6 +209,8 @@ export default function AdminCsvTemplateEditorPage() {
|
||||
} else {
|
||||
base.source_unit = sourceUnitId
|
||||
}
|
||||
delete base.target_unit
|
||||
delete base.conversion_factor
|
||||
tc[fieldKey] = base
|
||||
setTypeConversionsText(JSON.stringify(tc, null, 2))
|
||||
setError(null)
|
||||
@@ -586,7 +592,9 @@ export default function AdminCsvTemplateEditorPage() {
|
||||
<div className="form-label">3b. Quelleinheit (optional)</div>
|
||||
<p style={{ fontSize: 13, color: 'var(--text2)', marginTop: 8, lineHeight: 1.55 }}>
|
||||
Ziel-Einheit kommt aus dem Datenmodell (z. B. kcal, g, kg, km). Hier nur angeben, falls die CSV
|
||||
abweicht (z. B. FDDB kJ → kcal, Makros in kg → g, Gewicht in lb → kg).
|
||||
abweicht (z. B. FDDB kJ → kcal, Makros in kg → g, Gewicht in lb → kg). Beim Ändern hier werden
|
||||
pro Feld <code>conversion_factor</code> und <code>target_unit</code> entfernt (verhindert
|
||||
Doppel-Umrechnung); bei Bedarf wieder in Abschnitt 4 ergänzen.
|
||||
</p>
|
||||
<div style={{ marginTop: 14, display: 'flex', flexDirection: 'column', gap: 12 }}>
|
||||
{unitTargets.map(({ field: fkey, options }) => (
|
||||
|
||||
Reference in new issue
Block a user