Changed the code to use the currency_affinity value

This commit is contained in:
2025-08-31 19:13:04 +01:00
parent 8319b33c00
commit a67c103ccd
4 changed files with 21 additions and 4 deletions
+5 -1
View File
@@ -1,6 +1,7 @@
package expenses
import (
"expenses/config"
mod "expenses/expenses/models"
"log"
"time"
@@ -145,6 +146,9 @@ func ExpenseTotalPayed(exp *mod.Expense) decimal.Decimal {
}
func ExpenseIsEvenlyShared(exp *mod.Expense) bool {
cfg := config.GetInstance()
affi := cfg.CurrencyAffinity
shares := mapShares(exp)
payments := mapPayments(exp)
@@ -156,7 +160,7 @@ func ExpenseIsEvenlyShared(exp *mod.Expense) bool {
return false
}
if !val.Truncate(2).Equal(share.Truncate(2)) {
if !val.Truncate(affi).Equal(share.Truncate(affi)) {
return false
}
}