Skip to content

Commit

Permalink
feat: include route_pattern information in /status (#835)
Browse files Browse the repository at this point in the history
  • Loading branch information
lemald authored Oct 10, 2024
1 parent 5c34a9c commit ccc6eb3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/api_web/lib/api_web/views/status_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ defmodule ApiWeb.StatusView do
:facility,
:prediction,
:route,
:route_pattern,
:schedule,
:service,
:shape,
Expand All @@ -33,6 +34,10 @@ defmodule ApiWeb.StatusView do
%{last_updated: data.timestamps.route}
end

def route_pattern(data, _) do
%{last_updated: data.timestamps.route_pattern}
end

def schedule(data, _) do
%{last_updated: data.timestamps.schedule}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ defmodule ApiWeb.StatusControllerTest do
assert_attribute_key(json, "facility")
assert_attribute_key(json, "prediction")
assert_attribute_key(json, "route")
assert_attribute_key(json, "route_pattern")
assert_attribute_key(json, "schedule")
assert_attribute_key(json, "service")
assert_attribute_key(json, "shape")
Expand Down
1 change: 1 addition & 0 deletions apps/state/lib/state/metadata.ex
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ defmodule State.Metadata do
facility: last_updated(State.Facility),
prediction: last_updated(State.Prediction),
route: last_updated(State.Route),
route_pattern: last_updated(State.RoutePattern),
schedule: last_updated(State.Schedule),
service: last_updated(State.Service),
shape: last_updated(State.Shape),
Expand Down
1 change: 1 addition & 0 deletions apps/state/test/state/metadata_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ defmodule State.MetadataTest do
assert Map.has_key?(results, :facility)
assert Map.has_key?(results, :prediction)
assert Map.has_key?(results, :route)
assert Map.has_key?(results, :route_pattern)
assert Map.has_key?(results, :schedule)
assert Map.has_key?(results, :service)
assert Map.has_key?(results, :shape)
Expand Down

0 comments on commit ccc6eb3

Please sign in to comment.