Skip to content

Commit

Permalink
CV2-4458: fix claim query (#1858)
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy committed Apr 12, 2024
1 parent c91d2c6 commit fab2610
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/tasks/migrate/20240404154458_add_uuid_to_medias.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ namespace :check do
def claim_uuid_for_duplicate_quote
puts "Collect Claim uuid for duplicate quotes"
claim_uuid = {}
Claim.select('lower(quote) as quote, MIN(medias.id) as first')
.joins("INNER JOIN project_medias pm ON pm.media_id = medias.id")
.group('lower(quote)').having('COUNT(medias.id) > 1')
Claim.select('lower(quote) as quote, MIN(id) as first')
.group('lower(quote)').having('COUNT(id) > 1')
.each do |raw|
claim_uuid[Digest::MD5.hexdigest(raw['quote'])] = raw['first']
end
Expand Down

0 comments on commit fab2610

Please sign in to comment.