Fixes und Währungsumstellung

This commit is contained in:
2026-06-04 23:32:29 +02:00
parent aff5b2cf12
commit b5b7866395
10 changed files with 214 additions and 181 deletions

View File

@@ -1,5 +1,5 @@
{{/* Generischer Content Adapter fuer Einheitsumrechner */}}
{{/* Erzeugt alle from-to Permutationsseiten fuer linear, intermediate und runtime */}}
{{/* Erzeugt alle from-to Permutationsseiten fuer linear, temperatures und currencies */}}
{{ $pbBase := getenv "POCKETBASE_URL" | default site.Params.pocketbase_url }}
{{ $pbUrl := printf "%s/api/collections/currencies/records" $pbBase }}
@@ -35,7 +35,7 @@
{{ $categorySlug := $categoryData.slug }}
{{ $units := $categoryData.units }}
{{ if eq $engine "runtime" }}
{{ if eq $engine "currencies" }}
{{ if not $pbOk }}{{ continue }}{{ end }}
{{ $pbCurrencies := slice }}
{{ range $record := $pbData }}
@@ -76,7 +76,7 @@
"to_name" $toName
"slug" $slug
"description" $description
"engine" "runtime"
"engine" "currencies"
"rate" $rate
"rates_updated" $latestUpdate
}}
@@ -121,11 +121,21 @@
"from_factor" $fromData.factor
"to_factor" $toData.factor
) }}
{{ else if eq $engine "intermediate" }}
{{ else if eq $engine "temperatures" }}
{{ $convertFormulas := $categoryData.convertFormulas }}
{{ $formula := "" }}
{{ with index $convertFormulas $fromUnit }}
{{ $formula = index . $toUnit }}
{{ end }}
{{ $displayFormulas := $categoryData.formulas }}
{{ $displayFormula := "" }}
{{ with index $displayFormulas $fromUnit }}
{{ $displayFormula = index . $toUnit }}
{{ end }}
{{ $params = merge $params (dict
"engine" "intermediate"
"from_unit" $fromUnit
"to_unit" $toUnit
"engine" "temperatures"
"convertFormula" $formula
"displayFormula" $displayFormula
) }}
{{ end }}