See scheduled tasks on day of journal

I’m using the TODO and Journal calendar plugins. I want:

  • To create tasks on the journal of the day that they came into existence
  • Be able to schedule them (can do this using /Schedule)
  • Be able to see overdue items (can do this in TODO plugin screen)
  • Be able to see all tasks due on the journal page of the date they are due

I struggle with the last point. It works if I add a date both using /schedule, which makes queries and the TODO system work with due date, and a page reference using /date to the Journal page. But that’s two actions, error-prone and makes the date show twice. No idea why the TODO plugin doesn’t just work with /date for scheduling.

I’ve added a query to my journal template that shows tasks due today using ?day, but now when I navigate to tomorrow’s journal, I still only ever see tasks due today. I want to see tasks due on the day of that journal.

Is it possible to query tasks due on the date of the journal page the query is on? Or am I forcing something I shouldn’t and is there a much better workflow?

2 Likes

I don’t know about plugins or anything.
But I do know a thing or two about queries :slight_smile:

So with advanced queries we can have the page as input.
Here’s what it would look like.

#+BEGIN_QUERY
{:title [:b "Tasks scheduled for this page day"]
 :inputs [:query-page] ; lower-case name of the page the query is on
 :query [:find (pull ?b [*])
  :in $ ?page
  :where
   [?p :block/name ?page] ; this is always lower-case
   [?p :block/journal-day ?day]
   [?b :block/scheduled ?day]
   [?b :block/marker ?m]
   [(contains? #{"TODO" "LATER"} ?m)] ; can use whatever state you want here, just an example
 ]
}
#+END_QUERY

If you need more help or have more questions, let me know!

3 Likes

This works perfectly, in that it shows my tasks scheduled for the day of the journal page that I open, even if that day is not today. Thank you very much!

1 Like

Siferiax’s solution is of course a masterpiece. :grinning:

I just wanted to add: if you use the journal format yyyy-MM-dd then scheduled and overdue items will appear as unlinked references on those journal days.

3 Likes

That’s a really good piece of information, thanks! I don’t like the idea of the way a date is displayed having any kind of effect on how things work, but I do prefer this format so I’m test driving both these solutions for now.

Worth mentioning that changing the format is a bit messy for me since I have existing future journal pages, and this functionality will probably break if I want to change formats again in the future.

Thanks John!