diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index d266f5990..b89c407a3 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -217,6 +217,10 @@ class CoursesController < ApplicationController group.course_id = @course.id group.save end + @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + @is_remote = true + @members = searchStudent(@course) + @membercount = @members.count @course_groups = @course.course_groups end @@ -229,6 +233,8 @@ class CoursesController < ApplicationController @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' @is_remote = true @course_groups = @course.course_groups + @members = searchStudent(@course) + @membercount = @members.count end def join_group group = CourseGroup.find(params[:object_id]) @@ -283,11 +289,8 @@ class CoursesController < ApplicationController @members = searchTeacherAndAssistant(@course) when '2' @subPage_title = l :label_student_list - if @course_group_id - @members = search_student_in_group(@course, @course_group_id) - else - @members = searchStudent(@course) - end + @members = searchStudent(@course) + @membercount = @members.count else @subPage_title = '' @members = @course.member_principals.includes(:roles, :principal).all.sort diff --git a/app/models/course_group.rb b/app/models/course_group.rb index 6126352f6..c5c2f5c85 100644 --- a/app/models/course_group.rb +++ b/app/models/course_group.rb @@ -12,7 +12,7 @@ class CourseGroup < ActiveRecord::Base before_destroy :set_member_nil attr_accessible :name - + validates :name, :presence => true, :length => {:maximum => 20}, :uniqueness => true def set_member_nil if self.members && self.members.count > 0 self.members.update_all("course_group_id = 0") diff --git a/app/views/courses/_groups_name.html.erb b/app/views/courses/_groups_name.html.erb index 151eb9c7e..479bf27a5 100644 --- a/app/views/courses/_groups_name.html.erb +++ b/app/views/courses/_groups_name.html.erb @@ -1,4 +1,28 @@ +"