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

chore: Fix vendors #37

merged 4 commits into from
Oct 8, 2024

Conversation

cmaddox5
Copy link
Contributor

@cmaddox5 cmaddox5 commented Oct 8, 2024

The list of vendors we converted to atoms and the list of allowed vendors were out of sync. I simplified the from_json logic so it just converts the vendor into an atom. Any existing vendors set to n/a or empty strings will map to :n_a. All other unknown vendors will fail and we can fix as needed.

@cmaddox5 cmaddox5 requested a review from a team as a code owner October 8, 2024 15:47
@cmaddox5 cmaddox5 marked this pull request as draft October 8, 2024 15:52
lib/config/screen.ex Outdated Show resolved Hide resolved
lib/config/screen.ex Outdated Show resolved Hide resolved
@cmaddox5 cmaddox5 marked this pull request as ready for review October 8, 2024 18:02
@@ -122,14 +123,20 @@ defmodule ScreensConfig.Screen do
|> String.ends_with?(@v2_app_id_suffix)
end

for vendor <- ~w[gds mercury solari mimo c3ms outfront]a do
defp value_from_json("vendor", vendor_string, _app_id) when vendor_string in ["n/a", ""],
do: nil
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably want to include nil as a possible input here so the null that is ultimately saved to the configuration can round-trip successfully:

defp value_from_json("vendor", vendor, _app_id) when vendor in [nil, "", "n/a"], do: nil

@cmaddox5 cmaddox5 merged commit ff30a95 into main Oct 8, 2024
2 checks passed
@cmaddox5 cmaddox5 deleted the cm/fix-vendor-from-json branch October 8, 2024 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants