|
|
@@ -69,24 +69,26 @@
|
|
|
(let [repo (state/get-current-repo)
|
|
|
result (db-utils/seq-flatten query-result)
|
|
|
block? (:block/uuid (first result))]
|
|
|
- (if block?
|
|
|
- (let [result (if (seq remove-blocks)
|
|
|
- (let [remove-blocks (set remove-blocks)]
|
|
|
- (remove (fn [h]
|
|
|
- (contains? remove-blocks (:block/uuid h)))
|
|
|
- result))
|
|
|
- result)
|
|
|
- result (some->> result
|
|
|
- (db-utils/with-repo repo)
|
|
|
- (model/with-block-refs-count repo)
|
|
|
- (model/sort-blocks))]
|
|
|
- (if-let [result-transform (:result-transform q)]
|
|
|
- (if-let [f (sci/eval-string (pr-str result-transform))]
|
|
|
- (try
|
|
|
- (sci/call-fn f result)
|
|
|
- (catch js/Error e
|
|
|
- (log/error :sci/call-error e)
|
|
|
- result))
|
|
|
- result)
|
|
|
- (db-utils/group-by-page result)))
|
|
|
- result)))
|
|
|
+ (let [result (if block?
|
|
|
+ (let [result (if (seq remove-blocks)
|
|
|
+ (let [remove-blocks (set remove-blocks)]
|
|
|
+ (remove (fn [h]
|
|
|
+ (contains? remove-blocks (:block/uuid h)))
|
|
|
+ result))
|
|
|
+ result)]
|
|
|
+ (some->> result
|
|
|
+ (db-utils/with-repo repo)
|
|
|
+ (model/with-block-refs-count repo)
|
|
|
+ (model/sort-blocks)))
|
|
|
+ result)]
|
|
|
+ (if-let [result-transform (:result-transform q)]
|
|
|
+ (if-let [f (sci/eval-string (pr-str result-transform))]
|
|
|
+ (try
|
|
|
+ (sci/call-fn f result)
|
|
|
+ (catch js/Error e
|
|
|
+ (log/error :sci/call-error e)
|
|
|
+ result))
|
|
|
+ result)
|
|
|
+ (if block?
|
|
|
+ (db-utils/group-by-page result)
|
|
|
+ result)))))
|