Start integrating progress% into payments processing.

This commit is contained in:
Dominik Pantůček 2023-04-06 20:33:10 +02:00
parent c2f2e0b076
commit 7bee6fec99
2 changed files with 20 additions and 15 deletions

View file

@ -214,7 +214,8 @@ bank-fio.import.scm: $(BANK-FIO-SOURCES)
MEMBERS-PAYMENTS-SOURCES=members-payments.scm bank-account.import.scm \
dictionary.import.scm member-fees.import.scm \
period.import.scm configuration.import.scm utils.import.scm
period.import.scm configuration.import.scm utils.import.scm \
progress.import.scm
members-payments.o: members-payments.import.scm
members-payments.import.scm: $(MEMBERS-PAYMENTS-SOURCES)

View file

@ -51,7 +51,8 @@
member-fees
period
configuration
utils)
utils
progress)
;; Exchange rates
(define exchange-rates-lookup-table
@ -144,19 +145,22 @@
;; accounts and processes transactions.
(define (members-payments-process mb apikeys-file dir checked-fn)
(if apikeys-file
(let* ((acc-list (load-accounts-list apikeys-file))
(accounts (if acc-list (load-accounts acc-list dir) #f))
(last-checked (get-latest-checked-id checked-fn)))
(if accounts
(let ((mbp (foldl (lambda (mb ba)
(members-payments-process-bank mb ba last-checked))
mb
(filter identity
accounts))))
(members-base-update mbp identity member-sort-payments))
(let ()
(print "Warning: no accounts loaded!")
mb)))
(with-progress
#t "Payments"
(progress%-advance 0)
(let* ((acc-list (load-accounts-list apikeys-file))
(accounts (if acc-list (load-accounts acc-list dir) #f))
(last-checked (get-latest-checked-id checked-fn)))
(if accounts
(let ((mbp (foldl (lambda (mb ba)
(members-payments-process-bank mb ba last-checked))
mb
(filter identity
accounts))))
(members-base-update mbp identity member-sort-payments))
(let ()
(print "Warning: no accounts loaded!")
mb))))
mb))
;; Adds all balances - payments are converted to CZK in member-payments-total