|
|
@@ -47,10 +47,7 @@
|
|
|
"Return nil if block is not #card.
|
|
|
Return default card-map if `:logseq.property.fsrs/state` or `:logseq.property.fsrs/due` is nil"
|
|
|
[block-entity]
|
|
|
- (when (some (fn [tag]
|
|
|
- (assert (some? (:db/ident tag)) tag)
|
|
|
- (= :logseq.class/Card (:db/ident tag))) ;block should contains #Card
|
|
|
- (:block/tags block-entity))
|
|
|
+ (when (ldb/class-instance? (db/entity :logseq.class/Card) block-entity)
|
|
|
(let [fsrs-state (:logseq.property.fsrs/state block-entity)
|
|
|
fsrs-due (:logseq.property.fsrs/due block-entity)
|
|
|
return-default-card-map? (not (and fsrs-state fsrs-due))]
|
|
|
@@ -84,10 +81,13 @@
|
|
|
cards (when (and cards-id (not= (keyword cards-id) :global)) (db/entity cards-id))
|
|
|
query (:block/title cards)
|
|
|
result (query-dsl/parse query {:db-graph? true})
|
|
|
+ card-tag-id (:db/id (db/entity :logseq.class/Card))
|
|
|
+ card-tag-children-ids (db-model/get-structured-children repo card-tag-id)
|
|
|
+ card-ids (cons card-tag-id card-tag-children-ids)
|
|
|
q '[:find [?b ...]
|
|
|
- :in $ ?now-inst-ms %
|
|
|
+ :in $ [?t ...] ?now-inst-ms %
|
|
|
:where
|
|
|
- [?b :block/tags :logseq.class/Card]
|
|
|
+ [?b :block/tags ?t]
|
|
|
(or-join [?b ?now-inst-ms]
|
|
|
(and
|
|
|
[?b :logseq.property.fsrs/due ?due]
|
|
|
@@ -100,7 +100,7 @@
|
|
|
q
|
|
|
(if (coll? (first query*)) query* [query*])))
|
|
|
q)]
|
|
|
- (db-async/<q repo {:transact-db? false} q' now-inst-ms (:rules result))))
|
|
|
+ (db-async/<q repo {:transact-db? false} q' card-ids now-inst-ms (:rules result))))
|
|
|
|
|
|
(defn- btn-with-shortcut [{:keys [shortcut id btn-text due on-click class]}]
|
|
|
(let [bg-class (case id
|
|
|
@@ -252,7 +252,9 @@
|
|
|
all-cards (concat
|
|
|
[{:db/id :global
|
|
|
:block/title "All cards"}]
|
|
|
- (db-model/get-class-objects repo (:db/id (entity-plus/entity-memoized (db/get-db) :logseq.class/Cards))))
|
|
|
+ (db-model/get-class-objects repo (:db/id (entity-plus/entity-memoized (db/get-db) :logseq.class/Cards)))
|
|
|
+ ;; TODO: list all children tags of #Card
|
|
|
+ )
|
|
|
*block-ids (::block-ids state)
|
|
|
block-ids (rum/react *block-ids)
|
|
|
loading? (rum/react (::loading? state))
|