first commit
This commit is contained in:
129
pages/Family.md
Normal file
129
pages/Family.md
Normal file
@@ -0,0 +1,129 @@
|
||||
query-table:: true
|
||||
query-sort-by:: birthday
|
||||
query-sort-desc:: true
|
||||
query-properties:: [:birthday :who :page]
|
||||
#+BEGIN_QUERY
|
||||
{
|
||||
:query [:find (pull ?page [*]) ?birth-ddmm
|
||||
:keys people birthday
|
||||
:in $ ?start ?next
|
||||
:where
|
||||
[?page :block/name _]
|
||||
[?page :block/properties ?prop]
|
||||
[(get ?prop :birthday) ?birth]
|
||||
[?jpb :block/journal? true]
|
||||
[?jpb :block/original-name ?jbp-name]
|
||||
[(contains? ?birth ?jbp-name)]
|
||||
[?jpb :block/journal-day ?birth-int]
|
||||
[(str ?birth-int) ?birth-str]
|
||||
[(str ?start) ?start-str]
|
||||
;[(str ?next) ?next-str]
|
||||
[(re-pattern \"\\d{4}(\\d{4})\") ?rx]
|
||||
[(re-pattern \"(\\d{4})\\d{4}\") ?rx2]
|
||||
[(re-matches ?rx ?birth-str) [_ ?birth-ddmm]]
|
||||
[(re-matches ?rx2 ?start-str) [_ ?this-year]]
|
||||
[(str ?this-year ?birth-ddmm) ?this-y-birth]
|
||||
[(* 1 ?this-y-birth) ?this-y-birth-num]
|
||||
[(< ?this-y-birth-num ?next)]
|
||||
[(>= ?this-y-birth-num ?start)]
|
||||
]
|
||||
:inputs [:today :30d-after]
|
||||
:result-transform (fn [res]
|
||||
(sort-by (fn [s] (get-in s [:block/properties :birthday-int])) (map (fn [m]
|
||||
(update (:people m) :block/properties
|
||||
(fn [u] (assoc u :birthday-int (get-in m [:birthday]))
|
||||
))
|
||||
) res))
|
||||
)
|
||||
}
|
||||
#+END_QUERY
|
||||
|
||||
-
|
||||
- query-table:: true
|
||||
query-properties:: [:birthday :page]
|
||||
#+BEGIN_QUERY
|
||||
{:title "🎂 Birthday"
|
||||
:query [:find (pull ?b [*])
|
||||
:in $ ?today
|
||||
:where
|
||||
[?b :block/properties ?prop]
|
||||
[(get ?prop :birthday) ?birth]
|
||||
[?j :block/journal-day ?birthint]
|
||||
[?j :block/original-name ?jname]
|
||||
[(contains? ?birth ?jname)]
|
||||
[(str ?birthint) ?birthstr]
|
||||
[(subs ?birthstr 4) ?birthmd]
|
||||
[(str ?today) ?td]
|
||||
[(subs ?td 4) ?todaymd]
|
||||
[(= ?birthmd ?todaymd)]
|
||||
[?b :block/page ?p]
|
||||
]
|
||||
:inputs [:today]
|
||||
:collapsed? false}
|
||||
#+END_QUERY
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- #+BEGIN_QUERY
|
||||
{:title "🎂 UPCOMING BIRTHDAYS"
|
||||
:query [:find (pull ?h [*])
|
||||
:in $ ?start ?next
|
||||
:where
|
||||
[?h :block/scheduled ?d]
|
||||
[?p :block/name "birthday"]
|
||||
[?b :block/ref-pages ?p]
|
||||
[(mod ?start 10000) ?start-without-year]
|
||||
[(mod ?next 10000) ?next-without-year]
|
||||
[(mod ?d 10000) ?block-scheduled-without-year]
|
||||
[(> ?block-scheduled-without-year ?start-without-year)]
|
||||
[(< ?block-scheduled-without-year ?next-without-year)]
|
||||
]
|
||||
:inputs [:today :30d-after]
|
||||
:collapsed? false}
|
||||
#+END_QUERY
|
||||
- #+BEGIN_QUERY
|
||||
{:title "🎂 Birthday"
|
||||
:query [:find (pull ?b [*])
|
||||
:in $ ?today
|
||||
:where
|
||||
[?b :block/properties ?prop]
|
||||
[(get ?prop :birthday) ?birth]
|
||||
[?j :block/journal-day ?birthint]
|
||||
[?j :block/original-name ?jname]
|
||||
[(contains? ?birth ?jname)]
|
||||
[(str ?birthint) ?birthstr]
|
||||
[(subs ?birthstr 4) ?birthmd]
|
||||
[(str ?today) ?td]
|
||||
[(subs ?td 4) ?todaymd]
|
||||
[(= ?birthmd ?todaymd)]
|
||||
[?b :block/page ?p]
|
||||
]
|
||||
:inputs [:today]
|
||||
:collapsed? false}
|
||||
#+END_QUERY
|
||||
-
|
||||
- query-sort-by:: page
|
||||
query-table:: true
|
||||
query-sort-desc:: true
|
||||
query-properties:: [:page :birthday]
|
||||
#+BEGIN_QUERY
|
||||
{:title "🎂 Next birthdays 🎂"
|
||||
:query
|
||||
[:find
|
||||
?birthday ?page
|
||||
:in $ ?start ?next
|
||||
:where
|
||||
[?b :block/properties ?properties]
|
||||
[(get ?properties :birthday) ?birthday]
|
||||
[?b :block/left ?page]
|
||||
[?b :block/ref-pages ?p]
|
||||
[?p :block/journal? true]
|
||||
[?p :block/journal-day ?d]
|
||||
[(< ?d ?next)]
|
||||
[(>= ?d ?start)]]
|
||||
:table-view? true
|
||||
:inputs [:today :364-after]}
|
||||
#+END_QUERY
|
||||
-
|
||||
Reference in New Issue
Block a user