diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 87ab7e683..e76fa31dc 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -500,7 +500,8 @@ class CoursesController < ApplicationController end end - def course + def + course @school_id = params[:school_id] per_page_option = 10 if @school_id == "0" or @school_id.nil? diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 096ce7ad8..a862753ef 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -20,7 +20,7 @@ module CoursesHelper # 返回教师数量,即roles表中定义的Manager def teacherCount project - searchTeacherAndAssistant(project).count + project.members.count - studentCount(project).to_i # or # searchTeacherAndAssistant(project).count end @@ -114,7 +114,7 @@ module CoursesHelper # 学生人数计算 # add by nwb def studentCount course - searchStudent(course).count.to_s#course.student.count + course.student.count.to_s#course.student.count end #课程成员数计算 diff --git a/app/models/course.rb b/app/models/course.rb index 196e7168d..c11f66d49 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -38,7 +38,7 @@ class Course < ActiveRecord::Base validates_presence_of :password, :term,:name validates_format_of :class_period, :with =>/^[1-9]\d*$/ - validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/ + validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/ validates_length_of :description, :maximum => 10000 before_save :self_validate after_create :create_board_sync diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index d199097be..81c469fd8 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -1,21 +1,19 @@ -