diff --git a/lib/cluster_team.rb b/lib/cluster_team.rb index 97c03e8547..c7c9d4f5b8 100644 --- a/lib/cluster_team.rb +++ b/lib/cluster_team.rb @@ -38,7 +38,8 @@ def requests_count def fact_checks return [] unless @cluster.feed.data_points.to_a.include?(1) # Return empty if feed is not sharing fact-checks list = [] - ClaimDescription.where(project_media_id: self.project_medias.map(&:id)).each do |claim_description| + cluster_item_ids = self.project_medias.map(&:id) + ClaimDescription.where(project_media_id: cluster_item_ids).each do |claim_description| item = claim_description.project_media fact_check = claim_description.fact_check if item.report_status == 'published' list << OpenStruct.new({ @@ -47,7 +48,7 @@ def fact_checks fact_check_title: fact_check&.title, fact_check_summary: fact_check&.summary, rating: item.status_i18n, - media_count: Relationship.where(source_id: item.id, relationship_type: Relationship.confirmed_type).where('created_at < ?', @cluster.created_at).count + 1, + media_count: Relationship.where(source_id: item.id, relationship_type: Relationship.confirmed_type, target_id: cluster_item_ids).where('created_at < ?', @cluster.created_at).count + 1, requests_count: TiplineRequest.where(associated_type: 'ProjectMedia', associated_id: item.id).where('created_at < ?', @cluster.created_at).count, claim_description: claim_description })