We’ve got a bunch of people moving in and out of my team, and some permanents. I’ve got a bunch of people in pages called People/Adam, People/Eve, etc., and the temporary ones have tags:: temp and start-date:: 2022-09-01 and end-date:: 2022-10-15.
I’m trying to formulate a query that shows the People\* who have tags:: temp and whose start-date:: is <= today and end-date:: is >= today.
So far I have managed to put this together by mashing together a few different examples:
#+BEGIN_QUERY
{
:title "Active Temps"
:inputs [:today]
:query [
:find (pull ?b [*])
:in $ ?today
:where
[?b :block/properties ?properties]
[(get ?properties :start-date) ?start-date]
[(get ?properties :end-date) ?end-date]
[(and (<= ?start-date ?today) (>= ?end-date ?today))] ] }
#+END_QUERY
This sort-of works, but there are a few problems with it and I’m not sure how to fix it:
- I don’t think this is showing pages, it’s showing blocks, right?
- It’s not filtering based on
People\*pages - It’s not filtering based on presence of “temp” tag
- The results are duplicated. Each result appears twice
I’ve spent a few hours trying to get this working but so far no luck. Any Datalog gurus out there can lend me a hand please?