fixbug: 账户平衡计算导致新增交易异常
This commit is contained in:
parent
15a79c5790
commit
659c1d7e15
|
|
@ -82,7 +82,7 @@ func sum(entries []AddTransactionEntryForm, openingBalances string) decimal.Deci
|
|||
if entry.Account == openingBalances {
|
||||
return decimal.NewFromInt(0)
|
||||
}
|
||||
if entry.Price.IntPart() == 0 {
|
||||
if entry.Price.Exponent() == 0 {
|
||||
sumVal = entry.Number.Add(sumVal)
|
||||
} else {
|
||||
sumVal = entry.Number.Mul(entry.Price).Add(sumVal)
|
||||
|
|
@ -138,7 +138,6 @@ func AddTransactions(c *gin.Context) {
|
|||
|
||||
if err != nil {
|
||||
script.LogError(ledgerConfig.Mail, err.Error())
|
||||
InternalError(c, "failed to add transaction")
|
||||
return
|
||||
}
|
||||
OK(c, nil)
|
||||
|
|
|
|||
Loading…
Reference in New Issue