数据迁移不完整

This commit is contained in:
sw 2015-06-02 11:42:12 +08:00
parent bdbcc52320
commit 8d23815169
1 changed files with 4 additions and 2 deletions

View File

@ -2,8 +2,9 @@ class AddScoreToWork < ActiveRecord::Migration
require 'bigdecimal'
def up
count = StudentWork.all.count / 10 + 1
transaction do
for i in 1 ... 1000 do i
for i in 1 ... count do i
StudentWork.page(i).per(10).each do |work|
teacher_score = work.student_works_scores.where(:reviewer_role => 1).order("created_at desc")
unless teacher_score.empty?
@ -43,8 +44,9 @@ class AddScoreToWork < ActiveRecord::Migration
end
def down
count = StudentWork.all.count / 10 + 1
transaction do
for i in 1 ... 1000 do i
for i in 1 ... count do i
StudentWork.page(i).per(10).each do |work|
work.teacher_score = nil
work.teaching_asistant_score = nil