diff --git a/db/migrate/20150829024549_course_messages.rb b/db/migrate/20150829024549_course_messages.rb index a26a5a281..666ccdaeb 100644 --- a/db/migrate/20150829024549_course_messages.rb +++ b/db/migrate/20150829024549_course_messages.rb @@ -76,35 +76,34 @@ class CourseMessages < ActiveRecord::Migration end # 作品评阅 - course.homework_commons.each do |homework_common| - if homework_common.student_works - homework_common.student_works.each do |student_work| - if student_work.student_works_scores - student_work.student_works_scores.each do |student_works_score| - receiver = student_works_score.student_work.user - if student_works_score.created_at == student_works_score.updated_at - if student_works_score.comment.nil? - student_works_score.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => course.id, - :viewed => true, :content => "作业评分:#{student_works_score.score}", :status=> true) - else - student_works_score.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => course.id, - :viewed => true, :content => "作业评分:#{student_works_score.score}    评语:#{student_works_score.comment}", :status=> true) - end - else # 更新 - if student_works_score.comment.nil? - student_works_score.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => course.id, - :viewed => true, :content => "作业评分:#{student_works_score.score}", :status=> true) - else - student_works_score.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => course.id, - :viewed => true, :content => "作业评分:#{student_works_score.score}    评语:#{student_works_score.comment}", :status=> true) - end - end - end - end - end - end - end - + # course.homework_commons.each do |homework_common| + # if homework_common.student_works + # homework_common.student_works.each do |student_work| + # if student_work.student_works_scores + # student_work.student_works_scores.each do |student_works_score| + # receiver = student_works_score.student_work.user + # if student_works_score.created_at == student_works_score.updated_at + # if student_works_score.comment.nil? + # student_works_score.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => course.id, + # :viewed => true, :content => "作业评分:#{student_works_score.score}", :status=> true) + # else + # student_works_score.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => course.id, + # :viewed => true, :content => "作业评分:#{student_works_score.score}    评语:#{student_works_score.comment}", :status=> true) + # end + # else # 更新 + # if student_works_score.comment.nil? + # student_works_score.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => course.id, + # :viewed => true, :content => "作业评分:#{student_works_score.score}", :status=> true) + # else + # student_works_score.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => course.id, + # :viewed => true, :content => "作业评分:#{student_works_score.score}    评语:#{student_works_score.comment}", :status=> true) + # end + # end + # end + # end + # end + # end + # end # 作品讨论 end diff --git a/db/migrate/20150829081822_update_message_time.rb b/db/migrate/20150829081822_update_message_time.rb index 0bbc4458c..31dcb0b4f 100644 --- a/db/migrate/20150829081822_update_message_time.rb +++ b/db/migrate/20150829081822_update_message_time.rb @@ -20,7 +20,7 @@ class UpdateMessageTime < ActiveRecord::Migration end end - forge_count = ForgeMessage.all.count / 30 + 2 + forge_count = ForgeMessage.all.count / 30 + 1 transaction do for i in 1 ... forge_count do i ForgeMessage.page(i).per(30).each do |fmessage|