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

chore: Fix vendors #37

Merged
merged 4 commits into from
Oct 8, 2024
Merged
Changes from 2 commits
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
12 changes: 6 additions & 6 deletions lib/config/screen.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ defmodule ScreensConfig.Screen do
| :pre_fare_v2

@type t :: %__MODULE__{
vendor: :gds | :mercury | :solari | :c3ms | :outfront | :lg_mri | :mimo,
vendor: :gds | :mercury | :solari | :c3ms | :outfront | :lg_mri | :mimo | :n_a,
digitalcora marked this conversation as resolved.
Show resolved Hide resolved
device_id: String.t(),
name: String.t(),
app_id: app_id(),
Expand Down Expand Up @@ -122,12 +122,12 @@ defmodule ScreensConfig.Screen do
|> String.ends_with?(@v2_app_id_suffix)
end

for vendor <- ~w[gds mercury solari mimo c3ms outfront]a do
vendor_string = Atom.to_string(vendor)
defp value_from_json("vendor", vendor_string, _app_id) when vendor_string in ["n/a", ""] do
:n_a
end

defp value_from_json("vendor", unquote(vendor_string), _app_id) do
unquote(vendor)
end
defp value_from_json("vendor", vendor_string, _app_id) do
String.to_existing_atom(vendor_string)
digitalcora marked this conversation as resolved.
Show resolved Hide resolved
end

defp value_from_json("app_id", _app_id_string, app_id), do: app_id
Expand Down
Loading