[trep-engine] don't create intermediate cells object

from cell-calculators (a list of column-info), the cells object (list
of column-data) was created unnecessarily. use cell-calculators
directly.
This commit is contained in:
Christopher Lam 2020-06-13 22:47:32 +08:00
parent 51d00fcbe5
commit 78018d8f9c

View File

@ -1654,14 +1654,7 @@ be excluded from periodic reporting.")
(define (add-split-row split cell-calculators row-style transaction-row?) (define (add-split-row split cell-calculators row-style transaction-row?)
(let* ((account (xaccSplitGetAccount split)) (let* ((account (xaccSplitGetAccount split))
(reversible-account? (acc-reverse? account)) (reversible-account? (acc-reverse? account)))
(cells (map (lambda (cell)
(let ((split->monetary (vector-ref cell 1)))
(vector (split->monetary split)
(vector-ref cell 2) ;reverse?
(vector-ref cell 3) ;subtotal?
)))
cell-calculators)))
(unless (column-uses? 'subtotals-only) (unless (column-uses? 'subtotals-only)
(gnc:html-table-append-row/markup! (gnc:html-table-append-row/markup!
@ -1673,9 +1666,8 @@ be excluded from periodic reporting.")
split transaction-row?)) split transaction-row?))
left-columns) left-columns)
(map (lambda (cell) (map (lambda (cell)
(let* ((cell-monetary (vector-ref cell 0)) (let* ((cell-monetary ((vector-ref cell 1) split))
(reverse? (and (vector-ref cell 1) (reverse? (and (vector-ref cell 2) reversible-account?))
reversible-account?))
(cell-content (and cell-monetary (cell-content (and cell-monetary
(if reverse? (if reverse?
(gnc:monetary-neg cell-monetary) (gnc:monetary-neg cell-monetary)
@ -1686,13 +1678,10 @@ be excluded from periodic reporting.")
(if opt-use-links? (if opt-use-links?
(gnc:html-split-anchor split cell-content) (gnc:html-split-anchor split cell-content)
cell-content))))) cell-content)))))
cells)))) cell-calculators))))
(map (lambda (cell) (map (lambda (cell) (and (vector-ref cell 3) ((vector-ref cell 1) split)))
(let ((cell-monetary (vector-ref cell 0)) cell-calculators)))
(subtotal? (vector-ref cell 2)))
(and subtotal? cell-monetary)))
cells)))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;