Fixed issue where callsign was redundantly tweeted.
This commit is contained in:
parent
05b96b612b
commit
0f07b705c1
@ -110,14 +110,14 @@
|
|||||||
|
|
||||||
(defn get-adsbexchange-live-data [{:keys [url lat lon radius-nm api-key api-whitelist rapid-api?]}]
|
(defn get-adsbexchange-live-data [{:keys [url lat lon radius-nm api-key api-whitelist rapid-api?]}]
|
||||||
(let [url (str
|
(let [url (str
|
||||||
(->> [url
|
(->> [url
|
||||||
"lat" lat
|
"lat" lat
|
||||||
"lon" lon
|
"lon" lon
|
||||||
"dist" (.toFixed radius-nm (if rapid-api? 0 1))]
|
"dist" (.toFixed radius-nm (if rapid-api? 0 1))]
|
||||||
(map str)
|
(map str)
|
||||||
(string/join "/"))
|
(string/join "/"))
|
||||||
;; RapidAPI expects a trailing slash.
|
;; RapidAPI expects a trailing slash.
|
||||||
(if rapid-api? "/" ""))
|
(if rapid-api? "/" ""))
|
||||||
headers (cond-> (if rapid-api?
|
headers (cond-> (if rapid-api?
|
||||||
{:x-rapidapi-key api-key :x-rapidapi-host (:host (c-url/url url)) :useQueryString true}
|
{:x-rapidapi-key api-key :x-rapidapi-host (:host (c-url/url url)) :useQueryString true}
|
||||||
{:auth-key api-key})
|
{:auth-key api-key})
|
||||||
@ -523,19 +523,20 @@
|
|||||||
(defn template-data [ac ac-db-rec reverse nearby]
|
(defn template-data [ac ac-db-rec reverse nearby]
|
||||||
(let [rev-props (:properties reverse)
|
(let [rev-props (:properties reverse)
|
||||||
nearby (:properties nearby)
|
nearby (:properties nearby)
|
||||||
info (cond-> (-> ac
|
info (-> ac
|
||||||
(dissoc :history :type)
|
(dissoc :history :type)
|
||||||
(merge rev-props)
|
(merge rev-props)
|
||||||
(merge-adsbx-aircraft-db-rec ac-db-rec))
|
(merge-adsbx-aircraft-db-rec ac-db-rec))
|
||||||
|
info (cond-> info
|
||||||
(:military? ac)
|
(:military? ac)
|
||||||
(-> (assoc :militaryregistration (:registration ac)
|
(-> (assoc :militaryregistration (:registration info)
|
||||||
:militaryicao (:icao ac)))
|
:militaryicao (:icao info)))
|
||||||
nearby
|
nearby
|
||||||
(assoc :nearbylandmark (:name nearby)
|
(assoc :nearbylandmark (:name nearby)
|
||||||
:nearbydistance (-> nearby :distance km->miles (to-fixed 2)))
|
:nearbydistance (-> nearby :distance km->miles (to-fixed 2)))
|
||||||
(:speed ac)
|
(:speed info)
|
||||||
(assoc :speed (.toFixed (* (:speed ac) 1.15078) 0))
|
(assoc :speed (.toFixed (* (:speed info) 1.15078) 0))
|
||||||
(= (:registration ac) (:callsign ac))
|
(= (:registration info) (:callsign info))
|
||||||
(dissoc :callsign)
|
(dissoc :callsign)
|
||||||
;; TODO: If layer is "county", find the nearest city.
|
;; TODO: If layer is "county", find the nearest city.
|
||||||
)]
|
)]
|
||||||
|
Loading…
Reference in New Issue
Block a user