diff --git a/src/main/lemondronor/circlebot.cljs b/src/main/lemondronor/circlebot.cljs index 54b587c..646b093 100644 --- a/src/main/lemondronor/circlebot.cljs +++ b/src/main/lemondronor/circlebot.cljs @@ -291,6 +291,9 @@ (defn km->miles [km] (* km 0.621371)) +(defn to-fixed [n d] + (.toFixed n d)) + (defn generate-description [ac reverse wiki-nearby nearby] (let [rev-props (:properties reverse) nearby (:properties (first nearby)) @@ -301,10 +304,10 @@ :militaryicao (:icao ac))) wiki-nearby (assoc :nearbylandmark (:name wiki-nearby) - :nearbydistance (-> wiki-nearby :distance km->miles)) + :nearbydistance (-> wiki-nearby :distance km->miles (to-fixed 2))) (and nearby (not wiki-nearby)) (assoc :nearbylandmark (:name nearby) - :nearbydistance (-> nearby :distance km->miles)) + :nearbydistance (-> nearby :distance km->miles (to-fixed 2))) (:speed ac) (assoc :speed (.toFixed (* (:speed ac) 1.15078) 0)) (= (:registration ac) (:callsign ac))