REFACTOR: use scheme idioms

This commit is contained in:
Christopher Lam 2017-12-15 17:43:49 +08:00
parent 68aa61a37c
commit c7f9fb1a3a

View File

@ -1213,9 +1213,8 @@ Credit Card, and Income accounts."))))))
(let* ((document (gnc:make-html-document))
(account-matcher (opt-val pagename-filter optname-account-matcher))
(account-matcher-regexp (if (opt-val pagename-filter optname-account-matcher-regex)
(make-regexp account-matcher)
#f))
(account-matcher-regexp (and (opt-val pagename-filter optname-account-matcher-regex)
(make-regexp account-matcher)))
(c_account_0 (opt-val gnc:pagename-accounts optname-accounts))
(c_account_1 (filter
(lambda (acc)
@ -1232,9 +1231,8 @@ Credit Card, and Income accounts."))))))
(gnc:date-option-absolute-time
(opt-val gnc:pagename-general optname-enddate))))
(transaction-matcher (opt-val pagename-filter optname-transaction-matcher))
(transaction-matcher-regexp (if (opt-val pagename-filter optname-transaction-matcher-regex)
(make-regexp transaction-matcher)
#f))
(transaction-matcher-regexp (and (opt-val pagename-filter optname-transaction-matcher-regex)
(make-regexp transaction-matcher)))
(reconcile-status-filter (opt-val pagename-filter optname-reconcile-status))
(report-title (opt-val gnc:pagename-general gnc:optname-reportname))
(primary-key (opt-val pagename-sorting optname-prime-sortkey))
@ -1296,8 +1294,10 @@ Credit Card, and Income accounts."))))))
(if transaction-matcher-regexp
(regexp-exec transaction-matcher-regexp str)
(string-contains str transaction-matcher)))))
(and (if (eq? filter-mode 'include) (is-filter-member split c_account_2) #t)
(if (eq? filter-mode 'exclude) (not (is-filter-member split c_account_2)) #t)
(and (case filter-mode
((none) #t)
((include) (is-filter-member split c_account_2))
((exclude) (not (is-filter-member split c_account_2))))
(or (string-null? transaction-matcher) ; null-string = ignore filters
(match? (xaccTransGetDescription trans))
(match? (xaccTransGetNotes trans))