Adding :uploaddatetime because it is mentioned in the default scope

This commit is contained in:
Christoph Haas 2016-02-29 15:14:28 +01:00
parent 07bd3a6abc
commit 39149c26ad

View file

@ -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)