Skip to content

Commit

Permalink
tweak: Include triptych player name in data request logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jzimbel-mbta committed Sep 18, 2023
1 parent 910d92e commit 954fa5c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/screens/log_screen_data.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ defmodule Screens.LogScreenData do
screen_side \\ nil,
rotation_index \\ nil,
triptych_pane \\ nil,
triptych_player_name \\ nil,
ofm_app_package_version \\ nil
) do
if is_screen or not is_nil(requestor) do
Expand All @@ -34,6 +35,7 @@ defmodule Screens.LogScreenData do
|> insert_requestor(requestor)
|> insert_dup_rotation_index(rotation_index)
|> insert_triptych_pane(triptych_pane)
|> insert_triptych_player_name(triptych_player_name)
|> insert_version(ofm_app_package_version)

log_message("[screen data request]", data)
Expand Down Expand Up @@ -156,6 +158,11 @@ defmodule Screens.LogScreenData do
defp insert_triptych_pane(data, triptych_pane),
do: Map.put(data, :triptych_pane, triptych_pane)

defp insert_triptych_player_name(data, nil), do: data

defp insert_triptych_player_name(data, triptych_player_name),
do: Map.put(data, :triptych_player_name, triptych_player_name)

defp insert_version(data, nil), do: data
defp insert_version(data, version), do: Map.put(data, :ofm_app_package_version, version)
end
2 changes: 2 additions & 0 deletions lib/screens_web/controllers/v2/screen_api_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ defmodule ScreensWeb.V2.ScreenApiController do
screen_side = params["screen_side"]
rotation_index = params["rotation_index"]
triptych_pane = params["pane"]
triptych_player_name = params["player_name"]
ofm_app_package_version = params["version"]

LogScreenData.log_data_request(
Expand All @@ -34,6 +35,7 @@ defmodule ScreensWeb.V2.ScreenApiController do
screen_side,
rotation_index,
triptych_pane,
triptych_player_name,
ofm_app_package_version
)

Expand Down

0 comments on commit 954fa5c

Please sign in to comment.