Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak: Include triptych player name in data request logs #1867

Merged
merged 2 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we ever want to log DUP player names, we may want to consider renaming these params on the client. Just a thought, can't do that now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh hmm, we could... I could re-key the param over in show_triptych/2 before passing off to show/2.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally up to you. I think it will only be unclear once we add player name to params for DUPs. But I don't see us needing to do that in the near future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave it be for now.

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
Loading