Using created_at instead of legacy 'uploaddatetime' field

This commit is contained in:
Christoph Haas 2016-03-04 15:41:50 +01:00
parent 48ca75cb64
commit 3eeb9a63dc
6 changed files with 22 additions and 13 deletions

View file

@ -17,7 +17,7 @@ namespace :debshots do
loop do
destroyed = 0
Screenshot.select(:package_id, :image_fingerprint).group(:package_id, :image_fingerprint, :uploaddatetime).having("count(*) > 1").each do |ss|
Screenshot.select(:package_id, :image_fingerprint).group(:package_id, :image_fingerprint, :created_at).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)