Rebuild rubocop TODOs after auto-correcting
This commit is contained in:
parent
31c50255e9
commit
84dbb52d11
580 changed files with 3689 additions and 3133 deletions
|
|
@ -1,12 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
namespace :data do
|
||||
desc 'Update resources with nil quantity/used fields'
|
||||
task normalize_resources: :environment do
|
||||
Resource.where('used is ? or quantity is ?', nil, nil).each do |resource|
|
||||
resource.used = 0 if resource.used.blank?
|
||||
resource.quantity = resource.used if resource.quantity.blank?
|
||||
unless resource.save
|
||||
puts "Failed to update resource #{resource.name} (ID #{resource.id})"
|
||||
end
|
||||
puts "Failed to update resource #{resource.name} (ID #{resource.id})" unless resource.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue