From 47016be10307431d0b562944287f61aa11fa4268 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Thu, 15 Dec 2022 17:13:26 +1000 Subject: [PATCH] improve some things --- src/muneem/import.clj | 8 ++++++-- src/muneem/main.clj | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/muneem/import.clj b/src/muneem/import.clj index 929cd58..c647b34 100644 --- a/src/muneem/import.clj +++ b/src/muneem/import.clj @@ -368,6 +368,10 @@ #_(sh "cp" beancount-file "/home/anish/usr/finance/") (sh "scp" "documents/ledger.beancount" "mossnet.lan:~/usr/finance/ledger.beancount")) +(defn backup-beancount-file + [] + (sh "cp" beancount-file "./documents/backup.beancount")) + (defn assert-balance [transaction checking?] (let [b (balance transaction) @@ -383,8 +387,8 @@ [csv checking? & _args] (read-accounts beancount-file) (if checking? - (mapv write-transaction-to-file (drop-last (take-csv csv))) - (mapv write-transaction-to-file-savings (drop-last (take-csv csv)))) + (mapv write-transaction-to-file (take-csv csv)) + (mapv write-transaction-to-file-savings (take-csv csv))) (write-accounts beancount-file) (assert-balance (first (take-csv csv)) checking?) (reset! new-accounts #{})) diff --git a/src/muneem/main.clj b/src/muneem/main.clj index 518b269..4a2ee40 100644 --- a/src/muneem/main.clj +++ b/src/muneem/main.clj @@ -4,6 +4,7 @@ (defn -main [& _args] + (import/backup-beancount-file) (download/download-csv) (download/move-download) (import/main "./documents/checking.csv" true)