- ### Overdue

  - #+BEGIN*QUERY
    {:title [:h3 "🔥 Overdue"]
    :query [:find (pull ?block [*])
    :in $ ?start ?next
    :where
    (or-join [?block, ?d]
    [?block :block/scheduled ?d]
    [?block :block/deadline ?d]
    (and
    [?block :block/ref-pages ?rp]
    [?rp :block/journal-day ?d]
    )
    )
    (or-join [?block]
    (and
    [?block :block/marker ?marker]
    [(contains? #{"NOW" "TODO" "LATER" "DOING"} ?marker)]
    )
    (and
    (not [?block :block/marker *])
    (or
    [?block :block/scheduled ?d]
    [?block :block/deadline ?d]
    )
    )
    )

                  [(> ?d ?start)]
                  [(< ?d ?next)]]
                  :result-transform (fn [result]
                            (sort-by (fn [h]
                                       (or (get h :block/scheduled) (get h :block/deadline))) result))
          :inputs [:90d-before :0d-before]
          :collapsed? false},

    #+END_QUERY

- ### Deadlines and schedules for next week
  - query-table:: false
    #+BEGIN_QUERY
    {:title "next week deadline or schedule"
    :query [:find (pull ?block [*])
    :in $ ?start ?next
    :where
    (or
    [?block :block/scheduled ?d]
    [?block :block/deadline ?d])
    [(> ?d ?start)]
    [(< ?d ?next)]]
    :inputs [:today :7d-after]
    :collapsed? false}
    #+END_QUERY
- ### Now / later
  - {{query (and [[LATER]] (not [[excluded_in_query]] )) }}
    query-table:: false
    query-sort-by:: clock-time
    query-sort-desc:: false
  - {{query #NOW }}
    query-table:: false
    query-sort-by:: block
    query-sort-desc:: true
    collapsed:: true
- ### Todo / doing
  - ### Doing
    {{query #DOING }}
  - ### Todo
    collapsed:: true
    {{query #TODO }}
    - ### Done
      {{query #DONE }}
- ### Done
  {{query #DONE }}
