Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
caiosba committed Apr 3, 2024
2 parents 3eac255 + c65ac57 commit b2b6ecf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/cluster_team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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
})
Expand Down

0 comments on commit b2b6ecf

Please sign in to comment.