REFACTOR:bisect subtotal-get-info into primary/secondary

This commit is contained in:
Christopher Lam 2017-11-27 20:18:16 +08:00
parent e2912d1b9c
commit 7257675218

View File

@ -818,38 +818,34 @@ tags within description, notes or memo. ")
(cons 'sort-account-description (opt-val pagename-sorting (N_ "Show Account Description"))) (cons 'sort-account-description (opt-val pagename-sorting (N_ "Show Account Description")))
(cons 'notes (opt-val gnc:pagename-display (N_ "Notes"))))) (cons 'notes (opt-val gnc:pagename-display (N_ "Notes")))))
(define (primary-get-info info)
(define (subtotal-get-info name-sortkey name-subtotal name-date-subtotal info) (let ((sortkey (opt-val pagename-sorting optname-prime-sortkey)))
(let ((sortkey (opt-val pagename-sorting name-sortkey)))
(if (member sortkey DATE-SORTING-TYPES) (if (member sortkey DATE-SORTING-TYPES)
(keylist-get-info date-subtotal-list (opt-val pagename-sorting name-date-subtotal) info) (keylist-get-info date-subtotal-list (opt-val pagename-sorting optname-prime-date-subtotal) info)
(and (member sortkey SUBTOTAL-ENABLED) (and (member sortkey SUBTOTAL-ENABLED)
(and (opt-val pagename-sorting name-subtotal) (and (opt-val pagename-sorting optname-prime-subtotal)
(keylist-get-info sortkey-list sortkey info))))))
(define (secondary-get-info info)
(let ((sortkey (opt-val pagename-sorting optname-sec-sortkey)))
(if (member sortkey DATE-SORTING-TYPES)
(keylist-get-info date-subtotal-list (opt-val pagename-sorting optname-sec-date-subtotal) info)
(and (member sortkey SUBTOTAL-ENABLED)
(and (opt-val pagename-sorting optname-sec-subtotal)
(keylist-get-info sortkey-list sortkey info)))))) (keylist-get-info sortkey-list sortkey info))))))
(define primary-subtotal-comparator (define primary-subtotal-comparator
(subtotal-get-info optname-prime-sortkey (primary-get-info 'split-sortvalue))
optname-prime-subtotal
optname-prime-date-subtotal
'split-sortvalue))
(define secondary-subtotal-comparator
(subtotal-get-info optname-sec-sortkey
optname-sec-subtotal
optname-sec-date-subtotal
'split-sortvalue))
(define primary-renderer-key (define primary-renderer-key
(subtotal-get-info optname-prime-sortkey (primary-get-info 'renderer-key))
optname-prime-subtotal
optname-prime-date-subtotal (define secondary-subtotal-comparator
'renderer-key)) (secondary-get-info 'split-sortvalue))
(define secondary-renderer-key (define secondary-renderer-key
(subtotal-get-info optname-sec-sortkey (secondary-get-info 'renderer-key))
optname-sec-subtotal
optname-sec-date-subtotal
'renderer-key))
(let* ((work-to-do (length splits)) (let* ((work-to-do (length splits))
(work-done 0) (work-done 0)