mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-24 17:48:41 +02:00
fix: rounding erros when summing transactions
This commit is contained in:
@@ -60,11 +60,11 @@ _="on change from #transactions-list or htmx:afterSettle
|
|||||||
set total to 0.0
|
set total to 0.0
|
||||||
for amt in <.transaction:has(input[name='transactions']:checked) .main-amount .amount/>
|
for amt in <.transaction:has(input[name='transactions']:checked) .main-amount .amount/>
|
||||||
set amountValue to parseFloat(amt.getAttribute('data-amount'))
|
set amountValue to parseFloat(amt.getAttribute('data-amount'))
|
||||||
log amountValue
|
|
||||||
if not isNaN(amountValue)
|
if not isNaN(amountValue)
|
||||||
set total to total + amountValue
|
set total to (total * 100) + (amountValue * 100)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
set total to total / 100
|
||||||
put total.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into me
|
put total.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into me
|
||||||
end
|
end
|
||||||
on click
|
on click
|
||||||
|
|||||||
Reference in New Issue
Block a user