Skip to content

Commit

Permalink
Merge pull request #163 from alphagov/world-locations
Browse files Browse the repository at this point in the history
Include `world_locations` field in synced documents
  • Loading branch information
csutter authored Jan 4, 2024
2 parents 6b2800c + 5876141 commit b4d658a
Show file tree
Hide file tree
Showing 4 changed files with 1,364 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/models/concerns/publishing_api/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def metadata
government_name:,
organisation_state:,
locale: document_hash[:locale],
world_locations:,
parts:,
}.compact_blank
end
Expand Down Expand Up @@ -66,6 +67,14 @@ def organisation_state
.dig(:details, :organisation_govuk_status, :status)
end

def world_locations
# This isn't great, but there is no slug coming through from publishing-api and the v1
# search-api also manually generates slugs for world locations by parameterizing the title.
document_hash
.dig(:expanded_links, :world_locations)
&.map { _1[:title].parameterize }
end

def parts
document_hash
.dig(:details, :parts)
Expand Down
Loading

0 comments on commit b4d658a

Please sign in to comment.