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

Fix issue where [nil] is presented when no contacts #8781

Merged
merged 2 commits into from
Jan 31, 2024
Merged

Conversation

brucebolt
Copy link
Member

We were including an array containing a single value of nil, if a worldwide organisation had no contacts.

This is not valid against the schema. Therefore updating to publish an empty array instead.

Trello card

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

Follow these steps if you are doing a Rails upgrade.

@brucebolt brucebolt marked this pull request as ready for review January 31, 2024 08:39
@brucebolt brucebolt enabled auto-merge January 31, 2024 08:40
We were including an array containing a single value of `nil`, if a
worldwide organisation had no contacts.

This is not valid against the schema. Therefore updating to publish an
empty array instead.
@@ -90,6 +90,8 @@ def home_page_offices
end

def contacts
return [] unless item.main_office&.contact || item.home_page_offices&.map(&:contact)&.any?
Copy link
Contributor

Choose a reason for hiding this comment

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

would it be good to pull item.main_office&.contact and item.home_page_offices&.map(&:contact) into variables? As is they're used in a few places, not just in this file and am thinking it might be a bit easier to read

Copy link
Member Author

Choose a reason for hiding this comment

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

Done 👍

These pieces of code are used in multiple places, so can be DRY-ed up on
a model.
Copy link
Contributor

@JonathanHallam JonathanHallam left a comment

Choose a reason for hiding this comment

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

thanks!

@brucebolt brucebolt merged commit 81937c1 into main Jan 31, 2024
20 checks passed
@brucebolt brucebolt deleted the fix-wworg-contacts branch January 31, 2024 10:59
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