From 3313b4834a0fe3dc655a30dacc793d3793a98501 Mon Sep 17 00:00:00 2001 From: Cristen Jones Date: Thu, 15 Feb 2024 15:45:42 -0500 Subject: [PATCH 1/3] fixup merge commit --- mix.exs | 3 +++ mix.lock | 1 + 2 files changed, 4 insertions(+) diff --git a/mix.exs b/mix.exs index 0a19808c46..53359b735c 100644 --- a/mix.exs +++ b/mix.exs @@ -93,8 +93,10 @@ defmodule DotCom.Mixfile do {:ex_aws_s3, "2.5.3"}, {:ex_aws_ses, "2.4.1"}, {:ex_doc, "0.31.1", only: :dev}, + {:ex_machina, "2.7.0", only: :test}, # latest version 0.18.0; cannot upgrade because expects castore >= 1 {:excoveralls, "0.16.1", only: :test}, + {:faker, "0.17.0", only: :test}, {:floki, "0.35.3"}, {:gen_stage, "1.2.1"}, {:gettext, "0.24.0"}, @@ -109,6 +111,7 @@ defmodule DotCom.Mixfile do {:logster, "1.1.1"}, {:mail, "0.3.1"}, {:mock, "0.3.8", [only: :test]}, + {:mox, "1.1.0", [only: :test]}, {:nebulex, "2.6.0"}, {:nebulex_redis_adapter, "2.3.1"}, {:open_trip_planner_client, diff --git a/mix.lock b/mix.lock index cf64afad44..a4134a5e7b 100644 --- a/mix.lock +++ b/mix.lock @@ -57,6 +57,7 @@ "mint_web_socket": {:hex, :mint_web_socket, "1.0.3", "aab42fff792a74649916236d0b01f560a0b3f03ca5dea693c230d1c44736b50e", [:mix], [{:mint, ">= 1.4.1 and < 2.0.0-0", [hex: :mint, repo: "hexpm", optional: false]}], "hexpm", "ca3810ca44cc8532e3dce499cc17f958596695d226bb578b2fbb88c09b5954b0"}, "mochiweb": {:hex, :mochiweb, "2.22.0", "f104d6747c01a330c38613561977e565b788b9170055c5241ac9dd6e4617cba5", [:rebar3], [], "hexpm", "cbbd1fd315d283c576d1c8a13e0738f6dafb63dc840611249608697502a07655"}, "mock": {:hex, :mock, "0.3.8", "7046a306b71db2488ef54395eeb74df0a7f335a7caca4a3d3875d1fc81c884dd", [:mix], [{:meck, "~> 0.9.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "7fa82364c97617d79bb7d15571193fc0c4fe5afd0c932cef09426b3ee6fe2022"}, + "mox": {:hex, :mox, "1.1.0", "0f5e399649ce9ab7602f72e718305c0f9cdc351190f72844599545e4996af73c", [:mix], [], "hexpm", "d44474c50be02d5b72131070281a5d3895c0e7a95c780e90bc0cfe712f633a13"}, "nebulex": {:hex, :nebulex, "2.6.0", "6e581c0b53aab80a1431488d367a41c6a8ee53763f86e7a7a6754ee571ecfdab", [:mix], [{:decorator, "~> 1.4", [hex: :decorator, repo: "hexpm", optional: true]}, {:shards, "~> 1.1", [hex: :shards, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "cf4a0040bd6d58b8d0204f668641973520fdbd78bd8618e1cdb7a11e7bc560cf"}, "nebulex_redis_adapter": {:hex, :nebulex_redis_adapter, "2.3.1", "ea57629ee21f78332ca8d0356e6777d2fdbd6755b7453e298557091b6f8811f6", [:mix], [{:crc, "~> 0.10", [hex: :crc, repo: "hexpm", optional: true]}, {:jchash, "~> 0.1", [hex: :jchash, repo: "hexpm", optional: true]}, {:nebulex, "~> 2.5", [hex: :nebulex, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.5 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:redix, "~> 1.2", [hex: :redix, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "8384bf249af7c0b9903578b5c75a18157562863054952dbaea55dfe7255b75e7"}, "nimble_options": {:hex, :nimble_options, "1.1.0", "3b31a57ede9cb1502071fade751ab0c7b8dbe75a9a4c2b5bbb0943a690b63172", [:mix], [], "hexpm", "8bbbb3941af3ca9acc7835f5655ea062111c9c27bcac53e004460dfd19008a99"}, From 0847ac5332be55fe04741994b4d2b6fc1ee23ebf Mon Sep 17 00:00:00 2001 From: Cristen Jones Date: Wed, 14 Feb 2024 18:41:54 -0500 Subject: [PATCH 2/3] feat(TripPlan.Query): add new MostDirect tag bump open_trip_planner_client version, which adds support for MostDirect tag since v0.6. this also adjusts the returned data slightly, so when parsing we can use the agency name as opposed to parsing the agency GTFS ID. --- lib/dotcom/trip_plan/query.ex | 12 +++++++++--- lib/trip_plan/api/open_trip_planner.ex | 2 +- mix.exs | 2 +- mix.lock | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/dotcom/trip_plan/query.ex b/lib/dotcom/trip_plan/query.ex index 47d66432fc..c3e988a62b 100644 --- a/lib/dotcom/trip_plan/query.ex +++ b/lib/dotcom/trip_plan/query.ex @@ -1,7 +1,13 @@ defmodule Dotcom.TripPlan.Query do @moduledoc "Fetch trip plan via OTP and handle response" - alias OpenTripPlannerClient.ItineraryTag.{EarliestArrival, LeastWalking, ShortestTrip} + alias OpenTripPlannerClient.ItineraryTag.{ + EarliestArrival, + LeastWalking, + MostDirect, + ShortestTrip + } + alias TripPlan.{Itinerary, NamedPosition} defstruct [ @@ -13,8 +19,8 @@ defmodule Dotcom.TripPlan.Query do wheelchair: false ] - @otp_depart_at_tags [EarliestArrival, LeastWalking, ShortestTrip] - @otp_arrive_by_tags [LeastWalking, ShortestTrip] + @otp_depart_at_tags [EarliestArrival, MostDirect, LeastWalking] + @otp_arrive_by_tags [ShortestTrip, MostDirect, LeastWalking] @type query_itineraries :: {:ok, [Itinerary.t()]} | {:error, any()} @type position_error :: TripPlan.Geocode.error() | :same_address diff --git a/lib/trip_plan/api/open_trip_planner.ex b/lib/trip_plan/api/open_trip_planner.ex index 7c588fb846..8559afd79e 100644 --- a/lib/trip_plan/api/open_trip_planner.ex +++ b/lib/trip_plan/api/open_trip_planner.ex @@ -61,7 +61,7 @@ defmodule TripPlan.Api.OpenTripPlanner do polyline: json["legGeometry"]["points"], name: json["route"]["shortName"], long_name: json["route"]["longName"], - type: if(agency = json["agency"], do: id_after_colon(agency["gtfsId"])), + type: json["agency"]["name"], url: json["agency"]["url"], description: json["mode"] } diff --git a/mix.exs b/mix.exs index 53359b735c..4603d4c95f 100644 --- a/mix.exs +++ b/mix.exs @@ -117,7 +117,7 @@ defmodule DotCom.Mixfile do {:open_trip_planner_client, [ github: "thecristen/open_trip_planner_client", - ref: "v0.5.0" + ref: "v0.6.1" ]}, {:parallel_stream, "1.1.0"}, # latest version 1.7.11 diff --git a/mix.lock b/mix.lock index a4134a5e7b..34351f4fc6 100644 --- a/mix.lock +++ b/mix.lock @@ -63,7 +63,7 @@ "nimble_options": {:hex, :nimble_options, "1.1.0", "3b31a57ede9cb1502071fade751ab0c7b8dbe75a9a4c2b5bbb0943a690b63172", [:mix], [], "hexpm", "8bbbb3941af3ca9acc7835f5655ea062111c9c27bcac53e004460dfd19008a99"}, "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, "nimble_pool": {:hex, :nimble_pool, "1.0.0", "5eb82705d138f4dd4423f69ceb19ac667b3b492ae570c9f5c900bb3d2f50a847", [:mix], [], "hexpm", "80be3b882d2d351882256087078e1b1952a28bf98d0a287be87e4a24a710b67a"}, - "open_trip_planner_client": {:git, "https://github.com/thecristen/open_trip_planner_client.git", "deb8a814b276f2d6e4c2a07c72e87875c73489a0", [ref: "v0.5.0"]}, + "open_trip_planner_client": {:git, "https://github.com/thecristen/open_trip_planner_client.git", "31166f2c3f3e76d1041a7b4250d788420d3786e3", [ref: "v0.6.1"]}, "parallel_stream": {:hex, :parallel_stream, "1.1.0", "f52f73eb344bc22de335992377413138405796e0d0ad99d995d9977ac29f1ca9", [:mix], [], "hexpm", "684fd19191aedfaf387bbabbeb8ff3c752f0220c8112eb907d797f4592d6e871"}, "parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"}, "phoenix": {:hex, :phoenix, "1.6.16", "e5bdd18c7a06da5852a25c7befb72246de4ddc289182285f8685a40b7b5f5451", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "e15989ff34f670a96b95ef6d1d25bad0d9c50df5df40b671d8f4a669e050ac39"}, From 53c4a4dec3fe56a645ea2948692f0f69141f2568 Mon Sep 17 00:00:00 2001 From: Cristen Jones Date: Wed, 21 Feb 2024 15:28:09 -0500 Subject: [PATCH 3/3] hotfix for OTPClient error involving parsing routing errors --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 4603d4c95f..c3f43ac232 100644 --- a/mix.exs +++ b/mix.exs @@ -117,7 +117,7 @@ defmodule DotCom.Mixfile do {:open_trip_planner_client, [ github: "thecristen/open_trip_planner_client", - ref: "v0.6.1" + ref: "v0.6.2" ]}, {:parallel_stream, "1.1.0"}, # latest version 1.7.11