[#13257] Fix sync devices sorting

This commit is contained in:
Roman Volosovskyi 2022-04-19 12:51:20 +02:00
parent fd6b14fccc
commit 0c3097abb2
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
1 changed files with 4 additions and 6 deletions

View File

@ -43,12 +43,10 @@
(= our-installation-id (:installation-id b)) (= our-installation-id (:installation-id b))
1 1
:else :else
(let [enabled-compare (compare (:enabled? b) (let [enabled-compare (compare (:enabled? b) (:enabled? a))]
(:enabled? a))]
(if (not= 0 enabled-compare) (if (not= 0 enabled-compare)
enabled-compare enabled-compare
(compare (:timestamp b) (compare (:timestamp a) (:timestamp b))))))
(:timestamp a))))))
(defn sort-installations (defn sort-installations
[our-installation-id installations] [our-installation-id installations]
@ -189,10 +187,10 @@
:params [(or preferred-name name) identicon] :params [(or preferred-name name) identicon]
:on-success #(log/debug "successfully synced devices")}]})) :on-success #(log/debug "successfully synced devices")}]}))
(defn installation<-rpc [{:keys [metadata id enabled]}] (defn installation<-rpc [{:keys [metadata id enabled timestamp]}]
{:installation-id id {:installation-id id
:name (:name metadata) :name (:name metadata)
:timestamp (:timestamp metadata) :timestamp timestamp
:device-type (:deviceType metadata) :device-type (:deviceType metadata)
:enabled? enabled}) :enabled? enabled})