Skip to content

Commit

Permalink
Fix first_public_at date format issue
Browse files Browse the repository at this point in the history
Content store is returning `first_public_at` dates formatted to 3 decimal places. Ensure
the checks use the same date format.
  • Loading branch information
gpeng committed Sep 29, 2016
1 parent 966cf08 commit f321601
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/sync_checker/formats/edition_base.rb
Expand Up @@ -134,9 +134,7 @@ def expected_details_hash(edition)
body: Whitehall::GovspeakRenderer.new.govspeak_edition_to_html(edition),
change_history: edition.change_history.as_json,
emphasised_organisations: edition.lead_organisations.map(&:content_id),
first_public_at: first_public_at(edition),
political: edition.political?,
government: expected_government_value(edition)
first_public_at: first_public_at(edition)
}
end

Expand Down Expand Up @@ -165,7 +163,13 @@ def document_type
end

def first_public_at(edition)
(document.published? ? edition.first_public_at : document.created_at).try(:iso8601)
first_public_at = if document.published?
edition.first_public_at
else
document.created_at
end

first_public_at.to_datetime.rfc3339(3)
end

def expected_government_value(edition)
Expand Down

0 comments on commit f321601

Please sign in to comment.