From 0f07b705c18de8b785ec55a5cc0a437983b65641 Mon Sep 17 00:00:00 2001 From: John Wiseman Date: Sat, 26 Sep 2020 22:09:56 -0700 Subject: [PATCH] Fixed issue where callsign was redundantly tweeted. --- src/main/lemondronor/advisorycircular.cljs | 35 +++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/main/lemondronor/advisorycircular.cljs b/src/main/lemondronor/advisorycircular.cljs index c3a5de9..f3e2727 100644 --- a/src/main/lemondronor/advisorycircular.cljs +++ b/src/main/lemondronor/advisorycircular.cljs @@ -110,14 +110,14 @@ (defn get-adsbexchange-live-data [{:keys [url lat lon radius-nm api-key api-whitelist rapid-api?]}] (let [url (str - (->> [url - "lat" lat - "lon" lon - "dist" (.toFixed radius-nm (if rapid-api? 0 1))] - (map str) - (string/join "/")) - ;; RapidAPI expects a trailing slash. - (if rapid-api? "/" "")) + (->> [url + "lat" lat + "lon" lon + "dist" (.toFixed radius-nm (if rapid-api? 0 1))] + (map str) + (string/join "/")) + ;; RapidAPI expects a trailing slash. + (if rapid-api? "/" "")) headers (cond-> (if rapid-api? {:x-rapidapi-key api-key :x-rapidapi-host (:host (c-url/url url)) :useQueryString true} {:auth-key api-key}) @@ -523,19 +523,20 @@ (defn template-data [ac ac-db-rec reverse nearby] (let [rev-props (:properties reverse) nearby (:properties nearby) - info (cond-> (-> ac - (dissoc :history :type) - (merge rev-props) - (merge-adsbx-aircraft-db-rec ac-db-rec)) + info (-> ac + (dissoc :history :type) + (merge rev-props) + (merge-adsbx-aircraft-db-rec ac-db-rec)) + info (cond-> info (:military? ac) - (-> (assoc :militaryregistration (:registration ac) - :militaryicao (:icao ac))) + (-> (assoc :militaryregistration (:registration info) + :militaryicao (:icao info))) nearby (assoc :nearbylandmark (:name nearby) :nearbydistance (-> nearby :distance km->miles (to-fixed 2))) - (:speed ac) - (assoc :speed (.toFixed (* (:speed ac) 1.15078) 0)) - (= (:registration ac) (:callsign ac)) + (:speed info) + (assoc :speed (.toFixed (* (:speed info) 1.15078) 0)) + (= (:registration info) (:callsign info)) (dissoc :callsign) ;; TODO: If layer is "county", find the nearest city. )]