Skip to content

Commit

Permalink
Tariff: set default currency
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed May 18, 2023
1 parent 21aac85 commit ad250f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion tariff/awattar.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 3 additions & 5 deletions tariff/fixed.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit ad250f6

Please sign in to comment.