mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 06:57:35 +08:00
fix final rate calculation for the National Bank of Kazakhstan (#565)
This commit is contained in:
@@ -116,7 +116,7 @@ func (e *NationalBankOfKazakhstanExchangeRate) ToLatestExchangeRate(c core.Conte
|
||||
return nil
|
||||
}
|
||||
|
||||
finalRate := rate / unit
|
||||
finalRate := unit / rate
|
||||
if math.IsInf(finalRate, 0) {
|
||||
log.Warnf(c, "[national_bank_of_kazakhstan_datasource.ToLatestExchangeRate] final exchange rate calculation failed, currency is %s, unit is %s, rate is %s", e.Currency, e.Unit, e.Rate)
|
||||
return nil
|
||||
|
||||
@@ -55,12 +55,12 @@ func TestNationalBankOfKazakhstanDataSource_StandardDataExtractExchangeRates(t *
|
||||
|
||||
assert.Contains(t, resp.ExchangeRates, &models.LatestExchangeRate{
|
||||
Currency: "USD",
|
||||
Rate: "450.5",
|
||||
Rate: "0.0022197558268590455",
|
||||
})
|
||||
|
||||
assert.Contains(t, resp.ExchangeRates, &models.LatestExchangeRate{
|
||||
Currency: "VND",
|
||||
Rate: "0.0018",
|
||||
Rate: "555.5555555555555",
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user