Skip to content

Commit

Permalink
Skip model validations on old event update task
Browse files Browse the repository at this point in the history
  • Loading branch information
Senen committed Dec 27, 2017
1 parent b817e44 commit 5b658cb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/tasks/events.rake
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ namespace :events do
desc "Update old event status to done or accepted"
task update_old_event_status: :environment do
puts "Starting conversion of old events without status to accepted"
Event.where("status is ? AND scheduled > ?", nil, Time.zone.today).update_all(status: :accepted, lobby_activity: false)
Event.where("status is ? AND scheduled > ?", nil, Time.zone.today).each do |event|
event.update_attribute(:status, :accepted)
end
puts "Finished conversion of old events without status to accepted"

puts "Starting conversion of old events without status to done"
Event.where("status is ? AND scheduled <= ?", nil, Time.zone.today).update_all(status: :done, lobby_activity: false)
Event.where("status is ? AND scheduled <= ?", nil, Time.zone.today) do |event|
event.update_attribute(:status, :done)
end
puts "Finished conversion of old events without status to done"
end

Expand Down

0 comments on commit 5b658cb

Please sign in to comment.