mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-21 02:04:26 +08:00
improve robustness and add unit tests
This commit is contained in:
@@ -112,6 +112,11 @@ func (e *BankOfIsraelExchangeRate) ToLatestExchangeRate(c core.Context) *models.
|
||||
return nil
|
||||
}
|
||||
|
||||
if unit <= 0 {
|
||||
log.Warnf(c, "[bank_of_israel_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