|
47 | 47 | "Return nil if block is not #card. |
48 | 48 | Return default card-map if `:logseq.property.fsrs/state` or `:logseq.property.fsrs/due` is nil" |
49 | 49 | [block-entity] |
50 | | - (when (some (fn [tag] |
51 | | - (assert (some? (:db/ident tag)) tag) |
52 | | - (= :logseq.class/Card (:db/ident tag))) ;block should contains #Card |
53 | | - (:block/tags block-entity)) |
| 50 | + (when (ldb/class-instance? (db/entity :logseq.class/Card) block-entity) |
54 | 51 | (let [fsrs-state (:logseq.property.fsrs/state block-entity) |
55 | 52 | fsrs-due (:logseq.property.fsrs/due block-entity) |
56 | 53 | return-default-card-map? (not (and fsrs-state fsrs-due))] |
|
84 | 81 | cards (when (and cards-id (not= (keyword cards-id) :global)) (db/entity cards-id)) |
85 | 82 | query (:block/title cards) |
86 | 83 | result (query-dsl/parse query {:db-graph? true}) |
| 84 | + card-tag-id (:db/id (db/entity :logseq.class/Card)) |
| 85 | + card-tag-children-ids (db-model/get-structured-children repo card-tag-id) |
| 86 | + card-ids (cons card-tag-id card-tag-children-ids) |
87 | 87 | q '[:find [?b ...] |
88 | | - :in $ ?now-inst-ms % |
| 88 | + :in $ [?t ...] ?now-inst-ms % |
89 | 89 | :where |
90 | | - [?b :block/tags :logseq.class/Card] |
| 90 | + [?b :block/tags ?t] |
91 | 91 | (or-join [?b ?now-inst-ms] |
92 | 92 | (and |
93 | 93 | [?b :logseq.property.fsrs/due ?due] |
|
100 | 100 | q |
101 | 101 | (if (coll? (first query*)) query* [query*]))) |
102 | 102 | q)] |
103 | | - (db-async/<q repo {:transact-db? false} q' now-inst-ms (:rules result)))) |
| 103 | + (db-async/<q repo {:transact-db? false} q' card-ids now-inst-ms (:rules result)))) |
104 | 104 |
|
105 | 105 | (defn- btn-with-shortcut [{:keys [shortcut id btn-text due on-click class]}] |
106 | 106 | (let [bg-class (case id |
|
252 | 252 | all-cards (concat |
253 | 253 | [{:db/id :global |
254 | 254 | :block/title "All cards"}] |
255 | | - (db-model/get-class-objects repo (:db/id (entity-plus/entity-memoized (db/get-db) :logseq.class/Cards)))) |
| 255 | + (db-model/get-class-objects repo (:db/id (entity-plus/entity-memoized (db/get-db) :logseq.class/Cards))) |
| 256 | + ;; TODO: list all children tags of #Card |
| 257 | + ) |
256 | 258 | *block-ids (::block-ids state) |
257 | 259 | block-ids (rum/react *block-ids) |
258 | 260 | loading? (rum/react (::loading? state)) |
|
0 commit comments