                             (org-entry-get (point) "Effort"))
                   :where `(and ,(or org-ql-match '(todo))
                                ;; Is this redundant?  Could we just stick with `ts-active'?
-                               (or (scheduled :from ,start-date :to ,end-date)
-                                   (deadline :from ,start-date :to ,end-date)
-                                   (ts-active :from ,start-date :to ,end-date)))))
+                               (or (scheduled ,@start-date-expr ,@end-date-expr)
+                                   (deadline  ,@start-date-expr ,@end-date-expr)
+                                   (ts-active ,@start-date-expr ,@end-date-expr)))))
          (total-time (->> tasks
                           (-map #'(lambda (task)
                                     (let ((effort (cdr task)))


When ORG-QL-MATCH, an org-ql sexp, is given, filter the list of
tasks in range by this expression.  When ORG-QL-MATCH is not
given, default to `(todo)'."
  (let* (;; Allow Org syntax for dates; the result should be understandable by
         ;; `parse-time-string' and thus `org-ql-query' should be fine with that.
         (start-date (org-read-date nil nil start-date))
         (end-date (org-read-date nil nil end-date))
         (tasks (org-ql-query
                  :from (org-agenda-files)
                  :select '(cons

;;; Code:

(require 'subr-x)
(require 'dash)
(require 'cl-lib)
(require 'org)
(require 'org-agenda)
