From 9f859ee204f27ed251fbb4694fddfa282d76c5d6 Mon Sep 17 00:00:00 2001 From: John Wiseman Date: Sat, 14 Dec 2019 14:01:16 -0800 Subject: [PATCH] Fixed landmark distance units. --- src/main/lemondronor/circlebot.cljs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/lemondronor/circlebot.cljs b/src/main/lemondronor/circlebot.cljs index 808fc91..54b587c 100644 --- a/src/main/lemondronor/circlebot.cljs +++ b/src/main/lemondronor/circlebot.cljs @@ -288,6 +288,9 @@ (first results))) +(defn km->miles [km] + (* km 0.621371)) + (defn generate-description [ac reverse wiki-nearby nearby] (let [rev-props (:properties reverse) nearby (:properties (first nearby)) @@ -298,10 +301,10 @@ :militaryicao (:icao ac))) wiki-nearby (assoc :nearbylandmark (:name wiki-nearby) - :nearbydistance (:distance wiki-nearby)) + :nearbydistance (-> wiki-nearby :distance km->miles)) (and nearby (not wiki-nearby)) (assoc :nearbylandmark (:name nearby) - :nearbydistance (:distance nearby)) + :nearbydistance (-> nearby :distance km->miles)) (:speed ac) (assoc :speed (.toFixed (* (:speed ac) 1.15078) 0)) (= (:registration ac) (:callsign ac)) @@ -332,7 +335,7 @@ airport-properties (:properties airport)] (log-info "%s: Recent centroid is %s %s" icao lat lon) (if airport - (log-info "%s: Closest airport is %s, distance: %s" + (log-info "%s: Closest airport is %s, distance: %s km" (:icao ac) (:label airport-properties) (:distance airport-properties)) (log-info "%s: No airports nearby" (:icao ac))) (if (and airport-properties (<= (:distance airport-properties) minimum-airport-distance-km))