Skip to content

Commit

Permalink
Switch to using the government from links, rather than the details
Browse files Browse the repository at this point in the history
Currently, Whitehall includes the details of the associated government
for some content in the details. Now Whitehall also links the content
to a content item representing the government.

Using the linking approach is preferable going forward, as that means
the Publishing API can take care of updating the content store when a
government changes (becoming historical), rather than Whitehall having
to publish new editions.

This change to Government Frontend can be deployed once all the
relevant content has been linked to the correct government, something
which is being done in bulk from Whitehall.
  • Loading branch information
Christopher Baines committed Nov 27, 2019
1 parent 4140c21 commit 4f06d08
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/presenters/content_item/political.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ def political?
end

def historical?
content_item["details"].include?("government") && !content_item["details"]["government"]["current"]
government_current = content_item.dig(
"links", "government", 0, "details", "current"
)

# Treat no government as not historical
return false if government_current.nil?

!government_current
end
end
end

0 comments on commit 4f06d08

Please sign in to comment.