分组作业的作品列表提示的修改

分组作业提交作品时的最小人数限制不起作用
This commit is contained in:
cxt 2016-06-15 14:12:42 +08:00
parent c50d307e89
commit caa966c85a
6 changed files with 56 additions and 65 deletions

View File

@ -1096,7 +1096,8 @@ class StudentWorkController < ApplicationController
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}
student_work_id = @homework.student_work_projects.where("user_id=?",User.current.id).first.student_work_id
@commit_student_ids = @homework.student_work_projects.where("student_work_id != #{student_work_id}").map{|student| student.user_id}
@users = searchstudent_by_name all_students,name
respond_to do |format|
format.js

View File

@ -93,41 +93,31 @@
url: '<%= url_for(:controller => 'student_work', :action => 'search_course_students') %>'+'?homework='+<%=@homework.id %>,
type:'get'
});
<% if defined?(edit_mode) && edit_mode %>
<% pro = @homework.student_work_projects.where("user_id = ?",User.current.id).first.project_id.to_i %>
<% members = @homework.student_work_projects.where("project_id = ? and is_leader =?",pro,0) %>
<% members.each do |member| %>
var link = "<li id='choose_student_<%=member.user_id%>' onclick='delete_student(<%=member.user_id %>);'><%=member.user.show_name %>";
<% unless member.user.user_extensions.student_id == "" %>
link += "(<%=member.user.user_extensions.student_id %>)";
<% end %>
link += "</li>";
$("#choose_students_list").append(link);
<% end %>
<% end %>
var ids = $("#group_member_ids").val().split(',');
if (ids.length > 1){
for(var i=1; i<ids.length; i++) {
$.get(
'/student_work/get_user_infor',
{
user_id: ids[i]
},
function (data) {
if (data.valid) {
var link = "<li id='choose_student_"+data.id+"' onclick='delete_student("+data.id+");'>"+data.name;
if (data.student_id != "" ) {
link += "("+data.student_id+")";
}
link += "</li>";
$("#choose_students_list").append(link);
}
else
if($("#choose_student_"+ids[i]).length == 0) {
$.get(
'/student_work/get_user_infor',
{
user_id: ids[i]
},
function (data) {
if (data.valid) {
var link = "<li id='choose_student_"+data.id+"' onclick='delete_student("+data.id+");'>"+data.name;
if (data.student_id != "" ) {
link += "("+data.student_id+")";
}
link += "</li>";
$("#choose_students_list").append(link);
}
else
{
}
}
}
);
);
}
}
}
});

View File

@ -4,14 +4,21 @@
<font class="f12 c_red">
(<%= @student_work_count%>人已交)
</font>
<% my_work = @homework.student_works.where("user_id = #{User.current.id}").first %>
<%# my_work = @homework.student_works.where("user_id = #{User.current.id}").first %>
<% my_work = cur_user_works_for_homework @homework %>
<% if !@is_teacher && my_work.nil? && User.current.member_of_course?(@course) %>
<span class="f12 c_red">您尚未提交作品</span>
<%=link_to "提交作品", new_student_work_url_without_domain(@homework.id),:class => 'blueCir ml5 f12' %>
<% unless @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<%=link_to "提交作品", new_student_work_url_without_domain(@homework.id),:class => 'blueCir ml5 f12' %>
<% end %>
<% elsif !@is_teacher && my_work &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
<span class="f12 c_red">您已提交且不可再修改,因为截止日期已过</span>
<span class="f12 c_red">已提交且不可再修改,因为截止日期已过</span>
<% elsif !@is_teacher && my_work &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
<span class="f12 c_red">您已提交,您还可以修改</span>
<% if @homework.homework_type == 3 %>
<span class="f12 c_red">组长已提交,组长还可修改</span>
<% else %>
<span class="f12 c_red">您已提交,您还可以修改</span>
<% end %>
<% end %>
</span>
<%if @is_teacher || @homework.homework_detail_manual.comment_status == 3 || @homework.is_open == 1%>

View File

@ -103,21 +103,11 @@
}
function popupRegex(){
if($("#group_member_ids").length > 0) {
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
}
} else {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
}
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
}
function nh_check_field(params){
@ -140,6 +130,12 @@
params.contentmsg.html('');
}
}
if(!result) {
return result;
}
}
if($("#group_member_ids").length > 0) {
result=regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())));
}
return result;
}

View File

@ -62,21 +62,11 @@
}
// 作品校验
function popupRegex(){
if($("#group_member_ids").length > 0) {
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
}
} else {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
}
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
}
function nh_check_field(params){
@ -99,6 +89,12 @@
params.contentmsg.html('');
}
}
if(!result) {
return result;
}
}
if($("#group_member_ids").length > 0) {
result=regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())));
}
return result;
}

View File

@ -1,2 +1,3 @@
hideModal('#popbox02');
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false})%>");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false})%>");
$("#group_member_ids").val("<%=User.current.id %>");