mirror of
https://github.com/logseq/logseq.git
synced 2026-05-24 20:54:09 +00:00
fix: task sort by scheduled field make empty rows disappeared
fixes https://github.com/logseq/db-test/issues/315
This commit is contained in:
45
deps/db/src/logseq/db/common/view.cljs
vendored
45
deps/db/src/logseq/db/common/view.cljs
vendored
@@ -86,28 +86,29 @@
|
||||
(not asc?)
|
||||
reverse)
|
||||
|
||||
(not (ldb/db-based-graph? db)) ; file graph properties don't support index
|
||||
(sort (common-util/by-sorting
|
||||
[{:get-value get-value-fn
|
||||
:asc? asc?}]) entities)
|
||||
|
||||
:else
|
||||
(let [ref-type? (= :db.type/ref (:db/valueType property))]
|
||||
(if ref-type?
|
||||
(sort-ref-entities-by-single-property entities sorting get-value-fn)
|
||||
(let [datoms (cond->
|
||||
(->> (d/datoms db :avet id)
|
||||
(common-util/distinct-by :e)
|
||||
vec)
|
||||
(not asc?)
|
||||
rseq)
|
||||
row-ids (set (map :db/id entities))
|
||||
id->row (zipmap (map :db/id entities) entities)]
|
||||
(keep
|
||||
(fn [d]
|
||||
(when (row-ids (:e d))
|
||||
(id->row (:e d))))
|
||||
datoms)))))
|
||||
(sort-ref-entities-by-single-property entities sorting get-value-fn)
|
||||
|
||||
;; (let [ref-type? (= :db.type/ref (:db/valueType property))]
|
||||
;; (if ref-type?
|
||||
;; (sort-ref-entities-by-single-property entities sorting get-value-fn)
|
||||
|
||||
;; ;; FIXME: entity may not have the value
|
||||
;; ;; (let [datoms (cond->
|
||||
;; ;; (->> (d/datoms db :avet id)
|
||||
;; ;; (common-util/distinct-by :e)
|
||||
;; ;; vec)
|
||||
;; ;; (not asc?)
|
||||
;; ;; rseq)
|
||||
;; ;; row-ids (set (map :db/id entities))
|
||||
;; ;; id->row (zipmap (map :db/id entities) entities)]
|
||||
;; ;; (keep
|
||||
;; ;; (fn [d]
|
||||
;; ;; (when (row-ids (:e d))
|
||||
;; ;; (id->row (:e d))))
|
||||
;; ;; datoms))
|
||||
;; ))
|
||||
)
|
||||
distinct)]
|
||||
(if partition?
|
||||
(partition-by get-value-fn sorted-entities)
|
||||
@@ -132,6 +133,8 @@
|
||||
minor-sorting (seq (rest sorting))
|
||||
major-sorted-entities
|
||||
(sort-by-single-property db major-sorting entities (not-empty minor-sorting))]
|
||||
(prn :debug :count (count entities)
|
||||
:sorted (count major-sorted-entities))
|
||||
(if minor-sorting
|
||||
(sort-entities-by-minor-sorting db major-sorted-entities minor-sorting)
|
||||
major-sorted-entities)))
|
||||
|
||||
Reference in New Issue
Block a user