Problems with discover updates (#778)

This commit is contained in:
alwx 2017-02-16 13:10:22 +03:00 committed by Roman Volosovskyi
parent f930f9e127
commit 4bd800f5ca
1 changed files with 7 additions and 6 deletions

View File

@ -28,12 +28,13 @@
(fn [db [_ limit tags]] (fn [db [_ limit tags]]
(let [discoveries (reaction (:discoveries @db)) (let [discoveries (reaction (:discoveries @db))
current-tag (reaction (:current-tag @db)) current-tag (reaction (:current-tag @db))
search-tags (reaction (:discover-search-tags @db)) search-tags (reaction (:discover-search-tags @db))]
discoveries (->> (get-discoveries-by-tags @discoveries @current-tag (or tags @search-tags)) (reaction
(map #(assoc % :priority (calculate-priority db %))) (let [discoveries (->> (get-discoveries-by-tags @discoveries @current-tag (or tags @search-tags))
(map #(assoc % :priority (calculate-priority @db %)))
(sort-by :priority >))] (sort-by :priority >))]
(reaction {:discoveries (take limit discoveries) {:discoveries (take limit discoveries)
:total (count discoveries)})))) :total (count discoveries)})))))
(register-sub :get-recent-discoveries (register-sub :get-recent-discoveries
(fn [db] (fn [db]