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

Filter people roles by organisation #2906

Merged
merged 1 commit into from
Aug 25, 2023
Merged

Filter people roles by organisation #2906

merged 1 commit into from
Aug 25, 2023

Conversation

jkempster34
Copy link
Contributor

@jkempster34 jkempster34 commented Aug 24, 2023

Warning

🚨 Do not merge! 🚨
Depends on alphagov/whitehall#8162 being merged and all worldwide organisations being republished

https://trello.com/c/54I3mDxr

People linked to a worldwide organisation may have multiple roles, some of which are related to other organsaitions. Currently, we are incorrectly displaying these roles on the world wide organisation pages.

This copies the approach taken in alphagov/collections#1719. We link to all roles from the worldwide organisation, then filter out the incorrect ones in the rendering app.

See also alphagov/publishing-api#2478 and alphagov/whitehall#8162.


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

Follow these steps if you are doing a Rails upgrade.

@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2906 August 24, 2023 09:10 Inactive
jkempster34 added a commit to alphagov/publishing-api that referenced this pull request Aug 24, 2023
People linked to a worldwide organisation may have multiple roles, some of
which are related to other organsaitions. Currently, we are incorrectly
displaying these roles on the world wide organisation pages.

This copies the approach taken in alphagov/collections#1719. We link to all
roles from the worldwide organisation, then filter out the incorrect ones in
the rendering app.

See also alphagov/whitehall#8162 and alphagov/government-frontend#2906.
jkempster34 added a commit to alphagov/whitehall that referenced this pull request Aug 24, 2023
People linked to a worldwide organisation may have multiple roles, some of
which are related to other organsaitions. Currently, we are incorrectly
displaying these roles on the world wide organisation pages.

This copies the approach taken in alphagov/collections#1719. We link to all
roles from the worldwide organisation, then filter out the incorrect ones in
the rendering app.

See also alphagov/publishing-api#2478 and alphagov/government-frontend#2906.
People linked to a worldwide organisation may have multiple roles, some of
which are related to other organsaitions. Currently, we are incorrectly
displaying these roles on the worldwide organisation pages.

This copies the approach taken in alphagov/collections#1719. We link to all
roles from the worldwide organisation, then filter out the incorrect ones in
the rendering app.

See also alphagov/publishing-api#2478 and alphagov/whitehall#8162.
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2906 August 24, 2023 09:22 Inactive
@jkempster34 jkempster34 marked this pull request as ready for review August 24, 2023 13:08
@@ -6,15 +6,25 @@ def schema_name
end

test "description of primary_role_person should have spaces between roles" do
presenter = create_presenter(WorldwideOrganisationPresenter, content_item: { "links" => { "primary_role_person" => [{ "details" => { "image" => {} }, "links" => { "role_appointments" => [{ "details" => { "current" => true }, "links" => { "role" => [{ "title" => "Example Role 1" }] } }, { "details" => { "current" => true }, "links" => { "role" => [{ "title" => "Example Role 2" }] } }] } }] } })
presenter = create_presenter(WorldwideOrganisationPresenter, content_item: { "links" => { "primary_role_person" => [{ "details" => { "image" => {} }, "links" => { "role_appointments" => [{ "details" => { "current" => true }, "links" => { "role" => [{ "content_id" => "1", "title" => "Example Role 1" }] } }, { "details" => { "current" => true }, "links" => { "role" => [{ "content_id" => "2", "title" => "Example Role 2" }] } }] } }], "roles" => [{ "content_id" => "1" }, { "content_id" => "2" }] } })
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an existing ailment of the test, but would there be value in adding a test to check that when a person doesn't have any current roles for this org the presenter doesn't blow up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the persons role isn't in the filter list, they won't be in the content item at all, so this should be a non-problem. I'm wary of adding too many tests if they aren't needed.

I did wonder what happens if a role appointment doesn't have a role, but I don't think that is possible either, and that would have errored previously too

jkempster34 added a commit to alphagov/whitehall that referenced this pull request Aug 25, 2023
People linked to a worldwide organisation may have multiple roles, some of
which are related to other organsaitions. Currently, we are incorrectly
displaying these roles on the world wide organisation pages.

This copies the approach taken in alphagov/collections#1719. We link to all
roles from the worldwide organisation, then filter out the incorrect ones in
the rendering app.

See also alphagov/publishing-api#2478 and alphagov/government-frontend#2906.
@jkempster34 jkempster34 merged commit ac974fa into main Aug 25, 2023
@jkempster34 jkempster34 deleted the ww-org-filter-roles branch August 25, 2023 12:29
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.

3 participants