Skip to content

Commit

Permalink
Merge branch 'main' into kb-cacheable-scheds
Browse files Browse the repository at this point in the history
  • Loading branch information
KaylaBrady authored Nov 4, 2024
2 parents 26696e4 + 4a42f9f commit 53d580f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ defmodule MobileAppBackendWeb.PredictionsForStopsV2Channel do
)

if stop_id_concat == "" do
{:error, %{code: :no_stop_ids}}
{:ok,
%{
predictions_by_stop: %{},
trips: %{},
vehicles: %{}
}, socket}
else
{time_micros, initial_data} =
:timer.tc(fn ->
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "8a7abe6d183372ceb21caa2709bec928ab2b72e18a3911aa1771639bef82651e"},
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"},
"cowlib": {:hex, :cowlib, "2.13.0", "db8f7505d8332d98ef50a3ef34b34c1afddec7506e4ee4dd4a3a266285d282ca", [:make, :rebar3], [], "hexpm", "e1e1284dc3fc030a64b1ad0d8382ae7e99da46c3246b815318a4b848873800a4"},
"credo": {:hex, :credo, "1.7.8", "9722ba1681e973025908d542ec3d95db5f9c549251ba5b028e251ad8c24ab8c5", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "cb9e87cc64f152f3ed1c6e325e7b894dea8f5ef2e41123bd864e3cd5ceb44968"},
"credo": {:hex, :credo, "1.7.9", "07bb31907746ae2b5e569197c9e16c0d75c8578a22f01bee63f212047efb2647", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "f87c11c34ba579f7c5044f02b2a807e1ed2fa5fdbb24dc7eb4ad59c1904887f3"},
"decorator": {:hex, :decorator, "1.4.0", "a57ac32c823ea7e4e67f5af56412d12b33274661bb7640ec7fc882f8d23ac419", [:mix], [], "hexpm", "0a07cedd9083da875c7418dea95b78361197cf2bf3211d743f6f7ce39656597f"},
"dialyxir": {:hex, :dialyxir, "1.4.4", "fb3ce8741edeaea59c9ae84d5cec75da00fa89fe401c72d6e047d11a61f65f70", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "cd6111e8017ccd563e65621a4d9a4a1c5cd333df30cebc7face8029cacb4eff6"},
"diskusage_logger": {:hex, :diskusage_logger, "0.2.0", "04fc48b538fe4de43153542a71ea94f623d54707d85844123baacfceedf625c3", [:mix], [], "hexpm", "e3f2aed1b0fc4590931c089a6453a4c4eb4c945912aa97bcabcc0cff7851f34d"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ defmodule MobileAppBackendWeb.PredictionsForStopsV2ChannelTest do

response = %{
predictions_by_stop: %{
"12345" => %{"p_1" => prediction_1, "p_2" => prediction_2},
trips: %{"trip_1" => trip_1, "trip_2" => trip_2},
vehicles: %{"v_1" => vehicle_1, "v_2" => vehicle_2}
}
"12345" => %{"p_1" => prediction_1, "p_2" => prediction_2}
},
trips: %{"trip_1" => trip_1, "trip_2" => trip_2},
vehicles: %{"v_1" => vehicle_1, "v_2" => vehicle_2}
}

expect(PredictionsPubSubMock, :subscribe_for_stops, 1, fn _ ->
Expand All @@ -48,9 +48,11 @@ defmodule MobileAppBackendWeb.PredictionsForStopsV2ChannelTest do
assert reply == response
end

test "error if missing stop ids in topic", %{socket: socket} do
{:error, %{code: :no_stop_ids}} =
subscribe_and_join(socket, "predictions:stops:v2:")
test "empty data if missing stop ids in topic", %{socket: socket} do
assert {:ok, data, _socket} =
subscribe_and_join(socket, "predictions:stops:v2:")

assert data == %{predictions_by_stop: %{}, trips: %{}, vehicles: %{}}
end

test "handles new predictions", %{socket: socket} do
Expand Down

0 comments on commit 53d580f

Please sign in to comment.