提交作品选择分组成员时若某一个学生已加入到其他分组则不可选择
This commit is contained in:
parent
bb2f49439e
commit
c6470bc69b
|
@ -687,6 +687,7 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")"
|
||||
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
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
@ -18,7 +18,7 @@ $("#all_students_list").empty();
|
|||
}
|
||||
}
|
||||
}
|
||||
<% if user.id.to_i != User.current.id.to_i %>
|
||||
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? %>
|
||||
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
||||
$("#student_<%=user.id %>").one("click",function choose_student() {
|
||||
var li = "<li id='choose_student_<%=user.id %>'";
|
||||
|
@ -29,5 +29,9 @@ $("#all_students_list").empty();
|
|||
$("#choose_students_list").append(li);
|
||||
});
|
||||
}
|
||||
<% else %>
|
||||
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
||||
$("#student_<%=user.id %>").attr("title","该学生已加入其它分组");
|
||||
}
|
||||
<% end %>
|
||||
<% end %>
|
Loading…
Reference in New Issue