Skip to content

Commit

Permalink
Ensure distinct records are returned
Browse files Browse the repository at this point in the history
  • Loading branch information
pezholio committed Dec 10, 2024
1 parent 63ed7c2 commit f0b0546
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def unpaginated_documents
documents = documents.with_lead_organisation(@filters[:lead_organisation]) if @filters[:lead_organisation].present?
documents = documents.from_date(from_date) if valid? && from_date
documents = documents.to_date(to_date) if valid? && to_date
documents = documents.distinct
documents.order("content_block_editions.updated_at DESC")
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ContentBlockManager::DocumentFilterTest < ActiveSupport::TestCase
before do
ContentBlockManager::ContentBlock::Document.expects(:live).returns(document_scope_mock)
document_scope_mock.expects(:joins).with(:latest_edition).returns(document_scope_mock)
document_scope_mock.expects(:distinct).returns(document_scope_mock)
document_scope_mock.expects(:order).with("content_block_editions.updated_at DESC").returns(document_scope_mock)
document_scope_mock.expects(:per).with(15).returns([])
end
Expand Down

0 comments on commit f0b0546

Please sign in to comment.