Fork me on GitHub
#code-reviews
<
2019-09-24
>
escherize21:09:25

I'm late to the party, but I think this library really helps with those sorts of nested maps

escherize21:09:28

(deftrack good-trip?
  {:id trip-id
   :tripData {:startLocation start
              :endLocation end
              :segments segs}
   :tenantId tid
   :device {:id device-id}
   :accuracy accuracy}
  (and trip-id start end segs tid device-id accuracy
       (not (#{"BAD" "UNUSABLE"} accuracy))))

escherize21:09:13

This approach helps you see what a trip looks like without rebuilding it in your head

escherize21:09:37

this makes a function called good-trip? that you can call like so:

(good-trip?
 {:id 123
  :tripData {:startLocation 2323
             :endLocation 4545
             :segments [1 2 3]}
  :tenantId 99
  :device {:id 22}
  :accuracy "GOOD"})
;; => true