dev_local
cxt 6 years ago
parent 8db3062fc3
commit 0037604f9a

@ -0,0 +1,14 @@
class UpdateExeriseUserEndAt < ActiveRecord::Migration
def up
exercise = Exercise.where(:id => 123).first
exercise.exercise_group_settings.each do |group|
if group.end_time.present? && group.end_time < Time.now
user_ids = exercise.course.members.where(:course_group_id => group.course_group_id).map(&:user_id)
exercise.exercise_users.where(:commit_status => 1, :user_id => user_ids).update_all(:end_at => group.end_time)
end
end
end
def down
end
end
Loading…
Cancel
Save