From ad250f6d3da5a4bec962680b87db58bce04abb21 Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 18 May 2023 13:39:09 +0200 Subject: [PATCH] Tariff: set default currency --- tariff/awattar.go | 3 ++- tariff/fixed.go | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tariff/awattar.go b/tariff/awattar.go index c418001615..117a985040 100644 --- a/tariff/awattar.go +++ b/tariff/awattar.go @@ -34,7 +34,8 @@ func NewAwattarFromConfig(other map[string]interface{}) (api.Tariff, error) { Currency string Region string }{ - Region: "DE", + Currency: "EUR", + Region: "DE", } if err := util.DecodeOther(other, &cc); err != nil { diff --git a/tariff/fixed.go b/tariff/fixed.go index 2f8b98754b..272736bf86 100644 --- a/tariff/fixed.go +++ b/tariff/fixed.go @@ -25,23 +25,21 @@ func init() { } func NewFixedFromConfig(other map[string]interface{}) (api.Tariff, error) { - var cc struct { + cc := struct { Currency string Price float64 Zones []struct { Price float64 Days, Hours string } + }{ + Currency: "EUR", } if err := util.DecodeOther(other, &cc); err != nil { return nil, err } - if cc.Currency == "" { - cc.Currency = "EUR" - } - t := &Fixed{ unit: cc.Currency, clock: clock.New(),