I have a query for tasks referencing future date.
And wanted to add also blocks with /deadline or /schedule of future date.
How can I make them play nicely together?
I created the monster below to test it. The 3rd AND operator on it’s own works, and the first two together as well. Mixing them always returns 0 results. What am I missing?
#+BEGIN_QUERY
{:title "🟠 NEXT TO PLAY"
:query [:find (pull ?h [*])
:in $ ?today ?next
:where (or (and [?h :block/scheduled ?d]
[(>= ?d ?today)]
[(<= ?d ?next)])
(and [?h :block/deadline ?d]
[(>= ?d ?today)]
[(<= ?d ?next)])
(and [?h :block/marker ?marker]
[?h :block/path-refs ?p]
[?p :page/journal? true]
[?p :page/journal-day ?d]
[(contains? #{"NOW" "DOING" "TODO" "LATER" "WAITING"} ?marker)]
[(>= ?d ?today)]
[(<= ?d ?next)])
)
]
:inputs [:1d-after :30d-after]
:result-transform (fn [result]
(sort-by (fn [h]
(get h :block/priority "Z")) result))
:collapsed? false}
#+END_QUERY