From c2f9f7f70f9da3ca6de09010825d27c570e41534 Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Wed, 13 Nov 2024 12:57:46 -0300 Subject: [PATCH] fix: summing transactions with a lot of decimal places, drop the decimals --- app/templates/cotton/ui/transactions_action_bar.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/templates/cotton/ui/transactions_action_bar.html b/app/templates/cotton/ui/transactions_action_bar.html index d4500de..c7e9320 100644 --- a/app/templates/cotton/ui/transactions_action_bar.html +++ b/app/templates/cotton/ui/transactions_action_bar.html @@ -60,11 +60,12 @@ _="on change from #transactions-list or htmx:afterSettle set total to 0.0 for amt in <.transaction:has(input[name='transactions']:checked) .main-amount .amount/> set amountValue to parseFloat(amt.getAttribute('data-amount')) + log amountValue if not isNaN(amountValue) set total to total + amountValue end end - put total.toLocaleString() into me + put total.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 40}) into me end on click set original_value to my innerText