Advertisement
bgrolleman

Untitled

Jan 21st, 2023 (edited)
1,830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2. :title "🔨 All todos with current pages tag"
  3. ;; Fetch all TODO/DOING blocks using simple query
  4. :query (todo TODO DOING)
  5. ;; Check for journal-day
  6. :where
  7.   [?b :block/ref-pages ?p]
  8.   [?p :block/journal? true]
  9.   [?p :block/journal-day ?d]
  10. ;; Use Transform to fetch the parent page of a block (journal page) and then sort on journal-day of that page
  11. :result-transform
  12.  (fn [result]
  13.    (sort-by (fn [h](get (get h :block/page) :block/journal-day)) result)
  14.  )
  15. ;; Stuff I use to get debug data
  16. ;;:view (fn [result]
  17. ;;  (when (seq result)
  18. ;;    (let [blocks (flatten result)] [:p (pprint result)])
  19. ;;  )
  20. ;;)
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement