From 39149c26ad2b82848bae3a4f6507313face89422 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Mon, 29 Feb 2016 15:14:28 +0100 Subject: [PATCH] Adding :uploaddatetime because it is mentioned in the default scope --- lib/tasks/remove_image_duplicates.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)