数据迁移不完整
This commit is contained in:
parent
bdbcc52320
commit
8d23815169
|
@ -2,8 +2,9 @@ class AddScoreToWork < ActiveRecord::Migration
|
||||||
require 'bigdecimal'
|
require 'bigdecimal'
|
||||||
|
|
||||||
def up
|
def up
|
||||||
|
count = StudentWork.all.count / 10 + 1
|
||||||
transaction do
|
transaction do
|
||||||
for i in 1 ... 1000 do i
|
for i in 1 ... count do i
|
||||||
StudentWork.page(i).per(10).each do |work|
|
StudentWork.page(i).per(10).each do |work|
|
||||||
teacher_score = work.student_works_scores.where(:reviewer_role => 1).order("created_at desc")
|
teacher_score = work.student_works_scores.where(:reviewer_role => 1).order("created_at desc")
|
||||||
unless teacher_score.empty?
|
unless teacher_score.empty?
|
||||||
|
@ -43,8 +44,9 @@ class AddScoreToWork < ActiveRecord::Migration
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
|
count = StudentWork.all.count / 10 + 1
|
||||||
transaction do
|
transaction do
|
||||||
for i in 1 ... 1000 do i
|
for i in 1 ... count do i
|
||||||
StudentWork.page(i).per(10).each do |work|
|
StudentWork.page(i).per(10).each do |work|
|
||||||
work.teacher_score = nil
|
work.teacher_score = nil
|
||||||
work.teaching_asistant_score = nil
|
work.teaching_asistant_score = nil
|
||||||
|
|
Loading…
Reference in New Issue