Use when-not instead of single branch if-not and do
This commit is contained in:
parent
8e3279c39c
commit
b345eb824e
|
@ -148,19 +148,18 @@
|
|||
|
||||
(defn add-filter [filter-items filter-input filter-type]
|
||||
;; prevent duplicate filter strings
|
||||
(if-not (some #(= filter-input (:query %)) @filter-items)
|
||||
(do
|
||||
;; if existing, remove prior filter for :slower-than
|
||||
(when (and (= :slower-than filter-type)
|
||||
(some #(= filter-type (:filter-type %)) @filter-items))
|
||||
(swap! filter-items (fn [item]
|
||||
(remove #(= :slower-than (:filter-type %)) item))))
|
||||
;; add new filter
|
||||
(swap! filter-items conj {:id (random-uuid)
|
||||
:query (if (= filter-type :contains)
|
||||
(str/lower-case filter-input)
|
||||
(js/parseFloat filter-input))
|
||||
:filter-type filter-type}))))
|
||||
(when-not (some #(= filter-input (:query %)) @filter-items)
|
||||
;; if existing, remove prior filter for :slower-than
|
||||
(when (and (= :slower-than filter-type)
|
||||
(some #(= filter-type (:filter-type %)) @filter-items))
|
||||
(swap! filter-items (fn [item]
|
||||
(remove #(= :slower-than (:filter-type %)) item))))
|
||||
;; add new filter
|
||||
(swap! filter-items conj {:id (random-uuid)
|
||||
:query (if (= filter-type :contains)
|
||||
(str/lower-case filter-input)
|
||||
(js/parseFloat filter-input))
|
||||
:filter-type filter-type})))
|
||||
|
||||
(defn render-traces [showing-traces filter-items filter-input trace-detail-expansions]
|
||||
(doall
|
||||
|
|
Loading…
Reference in New Issue