diff --git a/lib/tasks/remove_image_duplicates.rake b/lib/tasks/remove_image_duplicates.rake index d67bb9d..b611c53 100644 --- a/lib/tasks/remove_image_duplicates.rake +++ b/lib/tasks/remove_image_duplicates.rake @@ -17,7 +17,7 @@ namespace :debshots do loop do destroyed = 0 - Screenshot.select(:package_id, :image_fingerprint).group(:package_id, :image_fingerprint).having("count(*) > 1").each do |ss| + Screenshot.select(:package_id, :image_fingerprint).group(:package_id, :image_fingerprint, :uploaddatetime).having("count(*) > 1").each do |ss| # Look again for screenshots of this fingerprint. # This extra step may seem stupid but the above query lead to package_id=NULL results sometimes. del = Screenshot.find_by(image_fingerprint: ss.image_fingerprint)