mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 01:34:24 +08:00
improve robustness and add unit tests
This commit is contained in:
@@ -134,6 +134,11 @@ func (e *CentralBankOfHungaryExchangeRate) ToLatestExchangeRate(c core.Context)
|
||||
return nil
|
||||
}
|
||||
|
||||
if unit <= 0 {
|
||||
log.Warnf(c, "[central_bank_of_hungary_datasource.ToLatestExchangeRate] unit is less or equal zero, currency is %s, unit is %s", e.Currency, e.Unit)
|
||||
return nil
|
||||
}
|
||||
|
||||
finalRate := unit / rate
|
||||
|
||||
if math.IsInf(finalRate, 0) {
|
||||
|
||||
Reference in New Issue
Block a user