[TR] apply custom-sort after filtering.

As a follow on to last commit, if a large datafile is subject to a
reconciled date filter, the initial QofQuery date matcher would be
skipped, causing a large number of splits sent for custom
sorting prior to filtering.

It will always be more efficient that filtering is applied
first. Therefore custom sorting should be applied after filtering.
This commit is contained in:
Christopher Lam 2018-06-18 10:37:28 +08:00
parent 3af9acec99
commit ae4b0bd871

View File

@ -1977,12 +1977,6 @@ be excluded from periodic reporting.")
(qof-query-destroy query)
(if custom-sort?
(begin
(set! splits (stable-sort! splits date-comparator?))
(set! splits (stable-sort! splits secondary-comparator?))
(set! splits (stable-sort! splits primary-comparator?))))
;; Combined Filter:
;; - include/exclude using split->date according to date options
;; - include/exclude splits to/from selected accounts
@ -2013,6 +2007,11 @@ be excluded from periodic reporting.")
)))
splits))
(when custom-sort?
(set! splits (stable-sort! splits date-comparator?))
(set! splits (stable-sort! splits secondary-comparator?))
(set! splits (stable-sort! splits primary-comparator?)))
(if (null? splits)
;; error condition: no splits found