From 4c2786ce569748044d65951af7aac098ea18182a Mon Sep 17 00:00:00 2001 From: John Wiseman Date: Tue, 7 Jan 2020 15:22:06 -0800 Subject: [PATCH] Add link to tar1090.adsbexchange.com in tweets. --- src/main/lemondronor/circlebot.cljs | 4 ++-- src/test/lemondronor/circlebot_test.cljs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/lemondronor/circlebot.cljs b/src/main/lemondronor/circlebot.cljs index 7aa6115..a06c10c 100644 --- a/src/main/lemondronor/circlebot.cljs +++ b/src/main/lemondronor/circlebot.cljs @@ -287,7 +287,8 @@ "?:[speed {speed} MPH, ]" "?:[squawking {squawk}, ]" "?:[{nearbydistance} miles from {nearbylandmark} ]" - "?:[#{registration}|#{militaryregistration}]")])) + "?:[#{registration} |#{militaryregistration} ]" + "https://tar1090.adsbexchange.com/?icao={icao}&zoom=13")])) (defn expand-template [data] (let [results (take 3 (generation/expand @@ -418,7 +419,6 @@ (get-basestation-sqb-record icao sqb-path))] (log-info "%s: Nearby geo search: %s potential landmarks, %s with wikipedia pages" icao (count nearby) (count wiki-nearby)) - (log-info "%s" (->> nearby (take 3) (map :properties))) (log-info "Nearest venues:") (log-table (->> nearby (take 3) (map :properties)) [:distance :label :locality :neighborhood :county :gid]) diff --git a/src/test/lemondronor/circlebot_test.cljs b/src/test/lemondronor/circlebot_test.cljs index 14e7380..827c489 100644 --- a/src/test/lemondronor/circlebot_test.cljs +++ b/src/test/lemondronor/circlebot_test.cljs @@ -100,9 +100,9 @@ (let [data {:locality "Palmdale", :continent "North America", :military? true, :alt 3200, :speed "161", :normalized-curviness 15.783422690487765, :accuracy "centroid", :country_a "USA", :continent_gid "whosonfirst:continent:102191575", :name "Palmdale", :squawk "5330", :icao "AE1482", :county_a "LO", :county "Los Angeles County", :source "whosonfirst", :gid "whosonfirst:locality:85923493", :curviness 1098.803548060181, :locality_gid "whosonfirst:locality:85923493", :region "California", :militaryicao "AE1482", :region_a "CA", :nearbydistance 7.828, :callsign "RAIDR49", :layer "locality", :mlat? false, :country_gid "whosonfirst:country:85633793", :label "Palmdale, CA, USA", :id "85923493", :lon -118.049183, :region_gid "whosonfirst:region:85688637", :lat 34.649808, :militaryregistration "166765", :county_gid "whosonfirst:county:102086957", :started-circling-time 1576267564959, :distance 6.336, :source_id "85923493", :registration "166765", :confidence 0.5, :country "United States", :postime 1576267555709, :nearbylandmark "Living Faith Foursquare Church"}] (is (re-find #"military" (-> (circlebot/expand-template data) :text)))) (testing "a vs. an for type" - (let [data {:registration "TEST" :type "Airbus 380" :locality "Test City"}] + (let [data {:registration "TEST" :icao "123" :type "Airbus 380" :locality "Test City"}] (is (re-find #"an Airbus" (:text (circlebot/expand-template data))))) - (let [data {:registration "TEST" :type "Yoyo 380" :locality "Test City"}] + (let [data {:registration "TEST" :icao "123" :type "Yoyo 380" :locality "Test City"}] (is (re-find #"a Yoyo" (:text (circlebot/expand-template data)))))))