diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index b79adda2d..650d97555 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -689,7 +689,12 @@ class StudentWorkController < ApplicationController unless params[:name].nil? name = params[:name] end - all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")" + if @homework.homework_detail_group.base_on_project == 0 + all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")" + else + pro = Project.find @homework.student_work_projects.where("user_id=?",User.current.id).first.project_id + all_student_ids = "(" + pro.members.map{|member| member.user_id}.join(",") + ")" + end all_students = User.where("id in #{all_student_ids}") @commit_student_ids = @homework.student_work_projects.map{|student| student.user_id} @users = searchstudent_by_name all_students,name diff --git a/app/views/student_work/_choose_group_member.html.erb b/app/views/student_work/_choose_group_member.html.erb index 1ec8ed0fa..f94250d23 100644 --- a/app/views/student_work/_choose_group_member.html.erb +++ b/app/views/student_work/_choose_group_member.html.erb @@ -1,6 +1,6 @@
-
请添加小组成员
+
请从<%= @homework.homework_detail_group.base_on_project == 1 ? '项目成员':'课程成员' %>中添加小组成员
diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index a71120d55..bd13fb7c1 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -11,6 +11,11 @@ $('#ajax-modal').parent().addClass("anonymos_work"); }); <% end%> + <% if @homework.homework_detail_group %> + $(function(){ + $('span.group_detail_info').text('分组人数:<%=@homework.homework_detail_group.min_num %>-<%=@homework.homework_detail_group.max_num %> 人'); + }); + <% end %> //快速创建项目的弹框 function new_project(){ diff --git a/app/views/student_work/search_course_students.js.erb b/app/views/student_work/search_course_students.js.erb index 1cea9f27e..c7aa982b9 100644 --- a/app/views/student_work/search_course_students.js.erb +++ b/app/views/student_work/search_course_students.js.erb @@ -18,7 +18,7 @@ $("#all_students_list").empty(); } } } - <% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? %> + <% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? && user.member_of_course?(@course) %> if (str.indexOf(<%=user.id.to_s %>) < 0) { $("#student_<%=user.id %>").one("click",function choose_student() { var li = "
  • + if (str.indexOf(<%=user.id.to_s %>) < 0) { + $("#student_<%=user.id %>").attr("title","该项目成员不是本课程的学生"); + } <% else %> if (str.indexOf(<%=user.id.to_s %>) < 0) { $("#student_<%=user.id %>").attr("title","该学生已加入其它分组");