Währungen in Kleinbuchstaben und kleine Fixes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
image: umrechner:v1.0.2
|
||||
image: umrechner:v1.0.3
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- POCKETBASE_URL={$POCKETBASE_URL}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
{{ $pbRates := dict }}
|
||||
{{ $latestUpdate := "" }}
|
||||
{{ range $record := $pbData }}
|
||||
{{ $pbRates = merge $pbRates (dict (lower $record.id) $record.rate) }}
|
||||
{{ $pbRates = merge $pbRates (dict $record.id $record.rate) }}
|
||||
{{ if or (eq $latestUpdate "") (gt $record.updated $latestUpdate) }}
|
||||
{{ $latestUpdate = $record.updated }}
|
||||
{{ end }}
|
||||
@@ -39,17 +39,17 @@
|
||||
{{ if not $pbOk }}{{ continue }}{{ end }}
|
||||
{{ $pbCurrencies := slice }}
|
||||
{{ range $record := $pbData }}
|
||||
{{ $pbCurrencies = $pbCurrencies | append (lower $record.id) }}
|
||||
{{ $pbCurrencies = $pbCurrencies | append $record.id }}
|
||||
{{ end }}
|
||||
{{ $availableCurrencies := $pbCurrencies | append "eur" }}
|
||||
{{ range $fromCode := $availableCurrencies }}
|
||||
{{ range $toCode := $availableCurrencies }}
|
||||
{{ if eq $fromCode $toCode }}{{ continue }}{{ end }}
|
||||
{{ $fromName := $fromCode | upper }}
|
||||
{{ $fromName := $fromCode }}
|
||||
{{ with index $units $fromCode }}
|
||||
{{ $fromName = .name }}
|
||||
{{ end }}
|
||||
{{ $toName := $toCode | upper }}
|
||||
{{ $toName := $toCode }}
|
||||
{{ with index $units $toCode }}
|
||||
{{ $toName = .name }}
|
||||
{{ end }}
|
||||
@@ -59,8 +59,8 @@
|
||||
{{ $description := printf
|
||||
"Konvertieren Sie %s in %s. Einfache und schnelle Umrechnung mit Einheitsumrechner."
|
||||
$fromName $toName }}
|
||||
{{ $fromCurrency := $fromCode | upper }}
|
||||
{{ $toCurrency := $toCode | upper }}
|
||||
{{ $fromCurrency := $fromCode }}
|
||||
{{ $toCurrency := $toCode }}
|
||||
{{ $fromRate := 1 }}
|
||||
{{ if ne $fromCode "eur" }}
|
||||
{{ $fromRate = index $pbRates $fromCode }}
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
|
||||
<link rel="manifest" href="/icons/site.webmanifest">
|
||||
<link href="/css/main.min.css" rel="stylesheet">
|
||||
{{ block "headscripts" . }}{{ end }}
|
||||
<script defer src="/js/decimal.js-light.min.js"></script>
|
||||
<script defer src="/js/converter.js"></script>
|
||||
<script defer src="/js/alpine-ajax-0.12.2.min.js"></script>
|
||||
<script defer src="/js/alpine-3.14.9.min.js"></script>
|
||||
<meta name="pocketbase-url" content="{{ getenv "POCKETBASE_URL" | default .Site.Params.pocketbase_url }}">
|
||||
|
||||
@@ -177,7 +177,4 @@
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ define "headscripts" }}
|
||||
<script defer src="/js/decimal.js-light.min.js"></script>
|
||||
<script defer src="/js/converter.js"></script>
|
||||
{{ end }}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
{{ with transform.Unmarshal .Content }}
|
||||
{{ if .items }}
|
||||
{{ range $record := .items }}
|
||||
{{ $pbCurrencies = $pbCurrencies | append (lower $record.id) }}
|
||||
{{ $pbCurrencies = $pbCurrencies | append $record.id }}
|
||||
{{ end }}
|
||||
{{ $pbOk = true }}
|
||||
{{ end }}
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
{{ if $pb.ok }}
|
||||
{{ $filtered := dict }}
|
||||
{{ range $slug, $data := $units }}
|
||||
{{ $slugLower := lower $slug }}
|
||||
{{ if or (eq $slugLower "eur") (in $pb.currencies $slugLower) }}
|
||||
{{ if or (eq $slug "eur") (in $pb.currencies $slug) }}
|
||||
{{ $filtered = merge $filtered (dict $slug $data) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
@@ -89,13 +89,11 @@ function createConverter(engine, config) {
|
||||
if (!normalized || isNaN(normalized)) {
|
||||
return;
|
||||
}
|
||||
const fromCode = (config.fromCurrency || '')
|
||||
.toUpperCase();
|
||||
const toCode = (config.toCurrency || '')
|
||||
.toUpperCase();
|
||||
const fromRate = fromCode === 'EUR'
|
||||
const fromCode = config.fromCurrency || '';
|
||||
const toCode = config.toCurrency || '';
|
||||
const fromRate = fromCode === 'eur'
|
||||
? 1 : this.rates[fromCode];
|
||||
const toRate = toCode === 'EUR'
|
||||
const toRate = toCode === 'eur'
|
||||
? 1 : this.rates[toCode];
|
||||
if (!fromRate || !toRate) {
|
||||
return;
|
||||
|
||||
@@ -23,7 +23,7 @@ function runImport() {
|
||||
let match;
|
||||
while ((match = CURRENCY_RATE_REGEX.exec(xml)) !== null) {
|
||||
rates.push({
|
||||
currency: match[1],
|
||||
currency: match[1].toLowerCase(),
|
||||
rate: parseFloat(match[2]),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user