Merge remote-tracking branch 'origin/develop' into guange_dev

This commit is contained in:
guange 2016-04-24 22:23:14 +08:00
commit 050d3c5440
3 changed files with 57 additions and 45 deletions

View File

@ -1,5 +1,6 @@
class UpdateOneStudentScore < ActiveRecord::Migration class UpdateOneStudentScore < ActiveRecord::Migration
def up def up
begin
student_work_score = StudentWorksScore.where("user_id = 11688 AND student_work_id = 34414").first student_work_score = StudentWorksScore.where("user_id = 11688 AND student_work_id = 34414").first
student_work_score.score = 100 student_work_score.score = 100
student_work_score.save student_work_score.save
@ -31,6 +32,9 @@ class UpdateOneStudentScore < ActiveRecord::Migration
end end
work.save work.save
end end
rescue => e
logger.error "[Errno::ENOENT] ===> #{e}"
end
end end
def down def down

View File

@ -1,5 +1,6 @@
class UpdateOneStudentTeacherScore < ActiveRecord::Migration class UpdateOneStudentTeacherScore < ActiveRecord::Migration
def up def up
begin
work = StudentWork.find 49774 work = StudentWork.find 49774
score = StudentWorksScore.new score = StudentWorksScore.new
score.score = 100 score.score = 100
@ -10,6 +11,9 @@ class UpdateOneStudentTeacherScore < ActiveRecord::Migration
work.teacher_score = score.score work.teacher_score = score.score
end end
work.save work.save
rescue => e
logger.error "[Errno::ENOENT] ===> #{e}"
end
end end
def down def down

View File

@ -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