Skip to content

Commit

Permalink
WIP: use edition links for ww organisations
Browse files Browse the repository at this point in the history
  • Loading branch information
brucebolt committed Jan 15, 2024
1 parent edbcb43 commit 94b7149
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def content
world_location_names:,
},
document_type: "worldwide_organisation",
links: edition_links,
public_updated_at: item.updated_at,
rendering_app: Whitehall::RenderingApp::GOVERNMENT_FRONTEND,
schema_name: "worldwide_organisation",
Expand All @@ -41,7 +42,7 @@ def content
content.merge!(PayloadBuilder::AnalyticsIdentifier.for(item))
end

def links
def edition_links
{
office_staff:,
main_office:,
Expand All @@ -54,6 +55,10 @@ def links
}
end

def links
{}
end

private

def body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,27 @@ def present(...)
},
],
},
links: {
main_office: [
worldwide_org.reload.offices.first.content_id,
],
home_page_offices: [],
office_staff: worldwide_org.office_staff_roles.map(&:current_person).map(&:content_id),
primary_role_person: [
ambassador.content_id,
],
roles: worldwide_org.roles.map(&:content_id),
secondary_role_person: [
deputy_head_of_mission.content_id,
],
sponsoring_organisations: worldwide_org.organisations.map(&:content_id),
world_locations: worldwide_org.world_locations.map(&:content_id),
},
analytics_identifier: "WO123",
update_type: "major",
}

expected_links = {
main_office: [
worldwide_org.reload.offices.first.content_id,
],
home_page_offices: [],
office_staff: worldwide_org.office_staff_roles.map(&:current_person).map(&:content_id),
primary_role_person: [
ambassador.content_id,
],
roles: worldwide_org.roles.map(&:content_id),
secondary_role_person: [
deputy_head_of_mission.content_id,
],
sponsoring_organisations: worldwide_org.organisations.map(&:content_id),
world_locations: worldwide_org.world_locations.map(&:content_id),
}
expected_links = {}

presented_item = present(worldwide_org)

Expand Down

0 comments on commit 94b7149

Please sign in to comment.