新的迁移

This commit is contained in:
huang 2016-03-05 08:00:56 +08:00
parent a079a61c82
commit 0a18f365ab
2 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
class UpdateContributor < ActiveRecord::Migration class UodapteContributorCourse < ActiveRecord::Migration
def up def up
Course.all.each do |course| Course.all.each do |course|
if course.course_activities.count > 1 if course.course_activities.count > 1
@ -21,7 +21,7 @@ class UpdateContributor < ActiveRecord::Migration
# 课程留言数 # 课程留言数
journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.user_id, course.id, "Course").count * 1 journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.user_id, course.id, "Course").count * 1
# 作业留言 # 作业留言
journal_homework_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.user_id, course.id, "HomeworkCommon").count * 1 journal_homework_count = JournalsForMessage.find_by_sql("SELECT jfm.* FROM `journals_for_messages` jfm, homework_commons hc where hc.id = jfm.jour_id and hc.course_id =#{course.id} and jfm.user_id =#{s.user_id} and jfm.jour_type ='HomeworkCommon';").count * 1
# journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1 # journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1
# journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1 # journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1
total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160304154643) do ActiveRecord::Schema.define(:version => 20160304200639) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false