Tariff: set default currency
Some checks failed
Some checks failed
This commit is contained in:
parent
21aac8538c
commit
ad250f6d3d
2 changed files with 5 additions and 6 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue