|
|
@ -1,5 +1,6 @@
|
|
|
|
class DeleteAnonymousWork < ActiveRecord::Migration
|
|
|
|
class DeleteAnonymousWork < ActiveRecord::Migration
|
|
|
|
def up
|
|
|
|
def up
|
|
|
|
|
|
|
|
begin
|
|
|
|
student_works = StudentWork.where("homework_common_id = 2882").map{|work| work.id} unless StudentWork.where("homework_common_id = 2882").empty?
|
|
|
|
student_works = StudentWork.where("homework_common_id = 2882").map{|work| work.id} unless StudentWork.where("homework_common_id = 2882").empty?
|
|
|
|
student_work_ids = "(" + student_works.join(",") + ")"
|
|
|
|
student_work_ids = "(" + student_works.join(",") + ")"
|
|
|
|
student_work_scores = StudentWorksScore.where("student_work_id in #{student_work_ids}")
|
|
|
|
student_work_scores = StudentWorksScore.where("student_work_id in #{student_work_ids}")
|
|
|
@ -12,6 +13,9 @@ class DeleteAnonymousWork < ActiveRecord::Migration
|
|
|
|
student_work.save
|
|
|
|
student_work.save
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
rescue => e
|
|
|
|
|
|
|
|
logger.error "[Errno::ENOENT] ===> #{e}"
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def down
|
|
|
|
def down
|
|
|
|