Commit 2a30acac authored by Ricardo J. Mendez's avatar Ricardo J. Mendez

Using functions pos? and zero?

parent b5145308
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
;; was deactivated (which defaults to now) ;; was deactivated (which defaults to now)
[app-state [_ tab end-time]] [app-state [_ tab end-time]]
; (console/trace " Deactivating " tab) ; (console/trace " Deactivating " tab)
(when (< 0 (:start-time tab)) (when (pos? (:start-time tab))
(dispatch [:track-time tab (- (or end-time (now)) (dispatch [:track-time tab (- (or end-time (now))
(:start-time tab))])) (:start-time tab))]))
app-state)) app-state))
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
:ts 0}) :ts 0})
track? (and (not= 0 id) track? (and (not= 0 id)
(not (contains? ignore-set (hostname url))) (not (contains? ignore-set (hostname url)))
(< 0 time)) (pos? time))
new-item (assoc url-item :time (+ (:time url-item) time) new-item (assoc url-item :time (+ (:time url-item) time)
:title (:title tab) :title (:title tab)
:ts timestamp)] :ts timestamp)]
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
:ts 0}) :ts 0})
track? (and (not= 0 id) track? (and (not= 0 id)
(not (contains? ignore-set host)) (not (contains? ignore-set host))
(< 0 time)) (pos? time))
new-item (assoc site-item :time (+ (:time site-item) time) new-item (assoc site-item :time (+ (:time site-item) time)
:icon (:favIconUrl tab) :icon (:favIconUrl tab)
:ts timestamp)] :ts timestamp)]
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
(-> (val %) (-> (val %)
(assoc :time (quot (:time (val %)) 1000)) (assoc :time (quot (:time (val %)) 1000))
(rename-keys {:timestamp :ts})))) (rename-keys {:timestamp :ts}))))
(remove #(= 0 (:time (second %))))))] (remove #(zero? (:time (second %))))))]
(assoc data (assoc data
:data-version 3 :data-version 3
:url-times url-times :url-times url-times
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
[seconds] [seconds]
(letfn [(time-label [major major-label minor minor-label] (letfn [(time-label [major major-label minor minor-label]
(apply str (concat [major major-label] (apply str (concat [major major-label]
(when (< 0 minor) [" " minor minor-label]))))] (when (pos? minor) [" " minor minor-label]))))]
(cond (cond
(< seconds 1) "< 1s" (< seconds 1) "< 1s"
(< seconds 60) (str seconds "s") (< seconds 60) (str seconds "s")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment