修改作业数据迁移

This commit is contained in:
nwb 2014-06-18 14:01:45 +08:00
parent 0480405afb
commit f80e1f811a
1 changed files with 1 additions and 2 deletions

View File

@ -4,10 +4,9 @@ class RenameProjectIdToHomeworkForCourses < ActiveRecord::Migration
# 作业数据迁移
HomeworkForCourse.all.each do |work|
project = Project.find_by_id(work.project_id)
project = Project.find_by_id(work.course_id)
if project && project.project_type == 1
work.course_id = project.course_extra.id
work.project_id = -1
work.save
end
end