分组作业提交作品时如果关联了项目则从项目成员中添加分组成员
This commit is contained in:
parent
89d3d3821c
commit
a2ebaa0729
|
@ -689,7 +689,12 @@ class StudentWorkController < ApplicationController
|
||||||
unless params[:name].nil?
|
unless params[:name].nil?
|
||||||
name = params[:name]
|
name = params[:name]
|
||||||
end
|
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}")
|
all_students = User.where("id in #{all_student_ids}")
|
||||||
@commit_student_ids = @homework.student_work_projects.map{|student| student.user_id}
|
@commit_student_ids = @homework.student_work_projects.map{|student| student.user_id}
|
||||||
@users = searchstudent_by_name all_students,name
|
@users = searchstudent_by_name all_students,name
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div id="popbox02">
|
<div id="popbox02">
|
||||||
<div>
|
<div>
|
||||||
<div class="relateText fl">请添加小组成员</div>
|
<div class="relateText fl">请从<%= @homework.homework_detail_group.base_on_project == 1 ? '项目成员':'课程成员' %>中添加小组成员</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="clickCanel();"></a></div>
|
<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="clickCanel();"></a></div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
$('#ajax-modal').parent().addClass("anonymos_work");
|
$('#ajax-modal').parent().addClass("anonymos_work");
|
||||||
});
|
});
|
||||||
<% end%>
|
<% 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(){
|
function new_project(){
|
||||||
|
|
|
@ -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) {
|
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
||||||
$("#student_<%=user.id %>").one("click",function choose_student() {
|
$("#student_<%=user.id %>").one("click",function choose_student() {
|
||||||
var li = "<li id='choose_student_<%=user.id %>'";
|
var li = "<li id='choose_student_<%=user.id %>'";
|
||||||
|
@ -29,6 +29,10 @@ $("#all_students_list").empty();
|
||||||
$("#choose_students_list").append(li);
|
$("#choose_students_list").append(li);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
<% elsif !user.member_of_course?(@course) %>
|
||||||
|
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
||||||
|
$("#student_<%=user.id %>").attr("title","该项目成员不是本课程的学生");
|
||||||
|
}
|
||||||
<% else %>
|
<% else %>
|
||||||
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
||||||
$("#student_<%=user.id %>").attr("title","该学生已加入其它分组");
|
$("#student_<%=user.id %>").attr("title","该学生已加入其它分组");
|
||||||
|
|
Loading…
Reference in New Issue