diff --git a/db/migrate/20150602021020_add_score_to_work.rb b/db/migrate/20150602021020_add_score_to_work.rb index 93045793c..446a5a4f7 100644 --- a/db/migrate/20150602021020_add_score_to_work.rb +++ b/db/migrate/20150602021020_add_score_to_work.rb @@ -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