emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/csv2ledger 80e39156a9 101/190: Fix c2l-amount-is-amount.


From: ELPA Syncer
Subject: [nongnu] elpa/csv2ledger 80e39156a9 101/190: Fix c2l-amount-is-amount.
Date: Sun, 2 Jun 2024 15:59:49 -0400 (EDT)

branch: elpa/csv2ledger
commit 80e39156a922329b82543780e303063160e261b2
Author: Joost Kremers <joostkremers@fastmail.fm>
Commit: Joost Kremers <joostkremers@fastmail.fm>

    Fix c2l-amount-is-amount.
    
    The default value of alist-get is only returned if the key returns nil, not 
if
    it returns the empty list, which is what would happen if the amount field is
    empty, because parse-csv-string returns an empty string in that case.
---
 csv2ledger.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/csv2ledger.el b/csv2ledger.el
index 00f154b950..68449e4843 100644
--- a/csv2ledger.el
+++ b/csv2ledger.el
@@ -264,7 +264,10 @@ TRANSACTION should be an alist containing field-value 
pairs and
 should contain a value for `amount', which is the return value.
 If `amount' does not contain a value, this function returns
 \"0.00\"."
-  (alist-get 'amount transaction "0.00"))
+  (let ((amount (alist-get 'amount transaction)))
+    (if (c2l--amount-p amount)
+        amount
+      "0.00")))
 
 (defun c2l-amount-is-credit-or-debit (transaction)
   "Return the amount of an entry.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]