修改课程学生计算函数

This commit is contained in:
nwb 2014-07-18 09:55:10 +08:00
parent 28543e3288
commit 6968039c87
2 changed files with 11 additions and 4 deletions

View File

@ -104,10 +104,17 @@ module CoursesHelper
garble count
end
alias studentCountOrigin studentCount
# 注意:此方法有问题,速度慢且结果不准
# alias studentCountOrigin studentCount
#def studentCount course
# count = studentCountOrigin course
#garble count
# end
# 学生人数计算
# add by nwb
def studentCount course
count = studentCountOrigin course
garble count
course.student.count
end
def eventToLanguageCourse event_type, course

View File

@ -21,7 +21,7 @@ class Course < ActiveRecord::Base
has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :homework_for_courses, :dependent => :destroy
has_many :student, :through => :students_for_courses, :source => :user
has_many :student, :class_name => 'StudentsForCourse', :source => :user
has_many :course_infos, :class_name => 'CourseInfos',:dependent => :destroy
has_many :enabled_modules, :dependent => :delete_all
has_many :boards, :dependent => :destroy, :order => "position ASC"