Compare commits

...

2 commits

Author SHA1 Message Date
Anish Lakhwara 47016be103 improve some things 2022-12-15 17:13:26 +10:00
Anish Lakhwara 60304168d7 assertion should be on the most recent entry 2022-12-08 12:25:52 +10:00
2 changed files with 8 additions and 3 deletions

View file

@ -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 (last (take-csv csv)) checking?)
(assert-balance (first (take-csv csv)) checking?)
(reset! new-accounts #{}))

View file

@ -4,6 +4,7 @@
(defn -main
[& _args]
(import/backup-beancount-file)
(download/download-csv)
(download/move-download)
(import/main "./documents/checking.csv" true)