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

Using functions pos? and zero?

parent b5145308
......@@ -231,7 +231,7 @@
;; was deactivated (which defaults to now)
[app-state [_ tab end-time]]
; (console/trace " Deactivating " tab)
(when (< 0 (:start-time tab))
(when (pos? (:start-time tab))
(dispatch [:track-time tab (- (or end-time (now))
(:start-time tab))]))
app-state))
......
......@@ -49,7 +49,7 @@
:ts 0})
track? (and (not= 0 id)
(not (contains? ignore-set (hostname url)))
(< 0 time))
(pos? time))
new-item (assoc url-item :time (+ (:time url-item) time)
:title (:title tab)
:ts timestamp)]
......@@ -72,7 +72,7 @@
:ts 0})
track? (and (not= 0 id)
(not (contains? ignore-set host))
(< 0 time))
(pos? time))
new-item (assoc site-item :time (+ (:time site-item) time)
:icon (:favIconUrl tab)
:ts timestamp)]
......
......@@ -30,7 +30,7 @@
(-> (val %)
(assoc :time (quot (:time (val %)) 1000))
(rename-keys {:timestamp :ts}))))
(remove #(= 0 (:time (second %))))))]
(remove #(zero? (:time (second %))))))]
(assoc data
:data-version 3
:url-times url-times
......
......@@ -98,7 +98,7 @@
[seconds]
(letfn [(time-label [major major-label minor minor-label]
(apply str (concat [major major-label]
(when (< 0 minor) [" " minor minor-label]))))]
(when (pos? minor) [" " minor minor-label]))))]
(cond
(< seconds 1) "< 1s"
(< 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