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 \ MEMBERS-PAYMENTS-SOURCES=members-payments.scm bank-account.import.scm \
dictionary.import.scm member-fees.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.o: members-payments.import.scm
members-payments.import.scm: $(MEMBERS-PAYMENTS-SOURCES) members-payments.import.scm: $(MEMBERS-PAYMENTS-SOURCES)

View file

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