Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
eb0e88d805
|
@ -73,11 +73,17 @@ class HomeworkCommonController < ApplicationController
|
|||
else
|
||||
@homework.publish_time = params[:homework_common][:publish_time]
|
||||
end
|
||||
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
||||
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
||||
@homework.course_id = params[:course_id]
|
||||
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
|
||||
if params[:homework_common][:anonymous_comment] && params[:homework_common][:anonymous_comment] != @homework.anonymous_comment
|
||||
if @homework.anonymous_comment == 1
|
||||
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 1.0 : 0.4
|
||||
else
|
||||
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 0.6 : 0.3
|
||||
end
|
||||
end
|
||||
|
||||
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
||||
if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
|
||||
homework_detail_manual.comment_status = 1
|
||||
end
|
||||
|
@ -94,6 +100,13 @@ class HomeworkCommonController < ApplicationController
|
|||
@homework.homework_detail_programing ||= HomeworkDetailPrograming.new
|
||||
@homework_detail_programing = @homework.homework_detail_programing
|
||||
@homework_detail_programing.language = params[:language_type].to_i
|
||||
if params[:homework_common][:anonymous_comment] && params[:homework_common][:anonymous_comment] != @homework.anonymous_comment
|
||||
if @homework.anonymous_comment == 1
|
||||
@homework_detail_programing.ta_proportion = 0.6
|
||||
else
|
||||
@homework_detail_programing.ta_proportion = 0.5
|
||||
end
|
||||
end
|
||||
|
||||
@homework.homework_tests.delete_all
|
||||
inputs = params[:program][:input]
|
||||
|
@ -116,6 +129,7 @@ class HomeworkCommonController < ApplicationController
|
|||
@homework_detail_group.base_on_project = params[:base_on_project].to_i
|
||||
end
|
||||
|
||||
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
|
||||
if @homework.save
|
||||
@homework_detail_manual.save if @homework_detail_manual
|
||||
@homework_detail_programing.save if @homework_detail_programing
|
||||
|
|
|
@ -504,6 +504,7 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
@is_focus = params[:is_focus] ? params[:is_focus].to_i : 0
|
||||
# 消息传过来的ID
|
||||
@message_student_work_id = params[:student_work_id]
|
||||
respond_to do |format|
|
||||
|
@ -920,8 +921,6 @@ class StudentWorkController < ApplicationController
|
|||
student_work.late_penalty = @homework.late_penalty
|
||||
student_work.save
|
||||
end
|
||||
|
||||
@homework.save
|
||||
end
|
||||
|
||||
if params[:absence_penalty] && homework_detail_manual.absence_penalty.to_s != params[:absence_penalty].to_s
|
||||
|
@ -944,7 +943,6 @@ class StudentWorkController < ApplicationController
|
|||
homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing
|
||||
@homework.teacher_priority = teacher_priority
|
||||
|
||||
@homework.save
|
||||
homework_detail_manual.save if homework_detail_manual
|
||||
homework_detail_programing.save if homework_detail_programing
|
||||
|
||||
|
@ -953,6 +951,8 @@ class StudentWorkController < ApplicationController
|
|||
student_work.save
|
||||
end
|
||||
end
|
||||
|
||||
@homework.save
|
||||
if params[:student_path]
|
||||
redirect_to student_work_index_url(:homework => @homework.id)
|
||||
else
|
||||
|
|
|
@ -750,7 +750,11 @@ class UsersController < ApplicationController
|
|||
render_attachment_warning_if_needed(homework)
|
||||
|
||||
homework_detail_manual = HomeworkDetailManual.new
|
||||
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 0.6 : 0.3
|
||||
if homework.anonymous_comment == 1
|
||||
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 1.0 : 0.4
|
||||
else
|
||||
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 0.6 : 0.3
|
||||
end
|
||||
if homework.publish_time > Date.today
|
||||
homework_detail_manual.comment_status = 0
|
||||
else
|
||||
|
@ -766,7 +770,11 @@ class UsersController < ApplicationController
|
|||
if homework.homework_type == 2
|
||||
homework_detail_programing = HomeworkDetailPrograming.new
|
||||
homework.homework_detail_programing = homework_detail_programing
|
||||
homework_detail_programing.ta_proportion = 0.5
|
||||
if homework.anonymous_comment == 1
|
||||
homework_detail_programing.ta_proportion = 0.6
|
||||
else
|
||||
homework_detail_programing.ta_proportion = 0.5
|
||||
end
|
||||
homework_detail_programing.language = params[:language_type].to_i
|
||||
|
||||
inputs = params[:program][:input]
|
||||
|
|
|
@ -2983,8 +2983,12 @@ def homework_common_index_url_in_org(course_id)
|
|||
Setting.protocol + "://" + Setting.host_name + "/homework_common?course=" + course_id.to_s
|
||||
end
|
||||
|
||||
def student_work_index_url_in_org(homework_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s
|
||||
def student_work_index_url_in_org(homework_id, is_focus = '')
|
||||
if is_focus != ''
|
||||
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&is_focus=" + is_focus.to_s
|
||||
else
|
||||
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s
|
||||
end
|
||||
end
|
||||
|
||||
def course_url_in_org(course_id)
|
||||
|
|
|
@ -66,11 +66,16 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
|
||||
<div class="homepagePostSubmit">
|
||||
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
|
||||
<%= user_for_homework_common activity,is_teacher %>
|
||||
</div>
|
||||
|
||||
<% work = cur_user_works_for_homework activity %>
|
||||
<% if activity.end_time < Date.today && !is_teacher && !work.nil? %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if activity.homework_type == 2 && is_teacher%>
|
||||
<div class="homepagePostSubmit">
|
||||
<%= link_to "模拟答题", Setting.protocol + "://" + Setting.host_name + "/users/new_user_commit_homework?homework_id="+activity.id.to_s + "&is_test=true", class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
|
||||
|
|
|
@ -119,6 +119,11 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
<% if defined?(is_focus) && is_focus.to_i == 1 %>
|
||||
$("#upload_revise_attachment").click();
|
||||
<% end %>
|
||||
});
|
||||
function show_upload(){
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>');
|
||||
showModal('ajax-modal', '452px');
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="mb10 mt5">
|
||||
<a href="javascript:void(0);" onclick="show_upload();" class="blueCir ml5" title="请选择文件上传">上传附件</a>
|
||||
<a href="javascript:void(0);" id="upload_revise_attachment" onclick="show_upload();" class="blueCir ml5" title="请选择文件上传">上传附件</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -19,21 +19,21 @@
|
|||
|
||||
<script>
|
||||
$("#sy_proportion").change(function(){
|
||||
var ta_proportion = 100 - parseInt($("#sy_proportion").val() * 100);
|
||||
var ta_proportion = 100 - parseInt(parseFloat($("#sy_proportion").val()) * 100);
|
||||
$("#ta_proportion").replaceWith(build_selector(ta_proportion));
|
||||
$("#student_proportion").val("0%");
|
||||
});
|
||||
|
||||
$("#ta_proportion").live("change",function(){
|
||||
var ta_proportion = 100 - parseInt($("#sy_proportion").val() * 100) - parseInt($("#ta_proportion").val() * 100);
|
||||
var ta_proportion = 100 - parseInt(parseFloat($("#sy_proportion").val()) * 100) - parseInt(parseFloat($("#ta_proportion")).val() * 100);
|
||||
$("#student_proportion").val(ta_proportion + "%");
|
||||
});
|
||||
</script>
|
||||
<% else%>
|
||||
<script>
|
||||
$("#ta_proportion").change(function(){
|
||||
var ta_proportion = $("#ta_proportion").val();
|
||||
$("#student_proportion").val((100 - parseInt(ta_proportion * 100)) + "%");
|
||||
var ta_proportion = parseFloat($("#ta_proportion").val());
|
||||
$("#student_proportion").val((100 - parseFloat(parseInt(ta_proportion * 100))) + "%");
|
||||
});
|
||||
</script>
|
||||
<% end%>
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
</ul>
|
||||
|
||||
<div id="revise_attachment">
|
||||
<%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %>
|
||||
<%= render :partial => 'student_work/revise_attachment', :locals => {:work => work,:is_focus => is_focus} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
|
@ -107,6 +107,9 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('student_work_img_<%=work.id %>');
|
||||
<% if defined?(is_focus) && is_focus.to_i == 1 %>
|
||||
$("#upload_revise_attachment").click();
|
||||
<% end %>
|
||||
});
|
||||
function show_upload(){
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>');
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<% my_work = @homework.student_works.where("user_id = #{User.current.id}").first %>
|
||||
<% 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' %>
|
||||
<% 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>
|
||||
<% 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?%>
|
||||
|
@ -58,7 +59,7 @@
|
|||
<% end %>
|
||||
<% unless work.nil? %>
|
||||
<% if @homework.homework_type == 2 %>
|
||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
|
||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
|
||||
|
||||
var program_name = "text/x-csrc";
|
||||
var language = <%= @homework.language %>;
|
||||
|
@ -82,11 +83,11 @@
|
|||
value: $("#work-src_<%= work.id%>").text()
|
||||
});
|
||||
<% elsif @homework.homework_type == 1 %>
|
||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
|
||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
|
||||
<% elsif @homework.homework_type == 3 %>
|
||||
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
|
||||
<% if pro && pro.student_work_id == work.id %>
|
||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
|
||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
|
||||
<% end %>
|
||||
<% end %>
|
||||
$('#score_<%= work.id%>').peSlider({range: 'min'});
|
||||
|
|
|
@ -71,7 +71,12 @@
|
|||
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
|
||||
<%= user_for_homework_common activity,is_teacher %>
|
||||
</div>
|
||||
|
||||
<% work = cur_user_works_for_homework activity %>
|
||||
<% if activity.end_time < Date.today && !is_teacher && !work.nil? %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if activity.homework_type == 2 && is_teacher%>
|
||||
<div class="homepagePostSubmit">
|
||||
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
|
||||
|
|
|
@ -70,6 +70,12 @@
|
|||
<div class="homepagePostSubmit">
|
||||
<%= user_for_homework_common homework_common,is_teacher %>
|
||||
</div>
|
||||
<% work = cur_user_works_for_homework homework_common %>
|
||||
<% if homework_common.end_time < Date.today && !is_teacher && !work.nil? %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "追加附件", student_work_index_url_in_org(homework_common.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if homework_common.homework_type == 2 && is_teacher%>
|
||||
<div class="homepagePostSubmit">
|
||||
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
<% if edit_mode && homework.is_group_homework? %>
|
||||
$("#GroupPopupBox a.group_save_btn").click();
|
||||
<% end %>
|
||||
<% if edit_mode %>
|
||||
$("#anonymous_comment").on('click',function(){
|
||||
$("#anonymous_hint").show();
|
||||
});
|
||||
<% end %>
|
||||
});
|
||||
function checked_val() {
|
||||
if ($("#anonymous_comment").is(":checked")) {
|
||||
|
@ -174,7 +179,8 @@
|
|||
<% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
|
||||
<div class="fl f14 ml10" style="margin-top: 4px;">
|
||||
<input type="checkbox" name="homework_common[anonymous_comment]" value="<%=edit_mode ? homework.anonymous_comment : 1 %>" id="anonymous_comment"/>
|
||||
<span class="f14 c_grey mr10">禁用匿评</span>
|
||||
<span class="f14 c_grey">禁用匿评</span>
|
||||
<span id="anonymous_hint" style="display: none; font-size: 12px;" class="c_red">更改后评分比例将恢复默认值</span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
<div class="mt10">
|
||||
<a href="javascript:void(0);" class="BlueCirBtn fl" data-homework-id="<%=@homework.id%>" data-student-work-id="<%=@student_work.id%>" id="test-program-btn">测试代码</a>
|
||||
<% if @is_test %>
|
||||
<%=link_to '返 回',homework_common_index_path(:course => @course.id),:class=>'fr mt6' %>
|
||||
<%=link_to '返 回',homework_common_index_path(:course => @course.id),:class=>'fr mt6',:style =>'line-height:30px;' %>
|
||||
<% else @is_test %>
|
||||
<a href="javascript:void(0);" class="BlueCirBtn fr" id="commit-program-work-btn">提交代码</a>
|
||||
<% end %>
|
||||
|
|
|
@ -22,6 +22,7 @@ $(function(){
|
|||
};
|
||||
|
||||
var test_program = function(cb){
|
||||
$('#test-program-btn').hide();
|
||||
var homework_id = $('#test-program-btn').attr('data-homework-id');
|
||||
var student_work_id = $('#test-program-btn').attr('data-student-work-id');
|
||||
var src = $('#program-src').val();
|
||||
|
@ -29,6 +30,7 @@ $(function(){
|
|||
var is_test = $('input[name=is_test]').val();
|
||||
|
||||
if(!valid_form()){
|
||||
$('#test-program-btn').show();
|
||||
return;
|
||||
}
|
||||
/*
|
||||
|
@ -78,17 +80,19 @@ $(function(){
|
|||
$('.ProResult').prepend(html);
|
||||
|
||||
if (data.status==0 && is_test != 'true') {
|
||||
if (typeof cb == 'function') {cb(data); return;}
|
||||
if (typeof cb == 'function') {cb(data);$('#test-program-btn').show(); return;}
|
||||
var r=confirm("答题正确,是否立刻提交?");
|
||||
if (r) {
|
||||
$(".HomeWorkCon form").submit();
|
||||
}
|
||||
$('#test-program-btn').show();
|
||||
return;
|
||||
}
|
||||
|
||||
//2 超时 -2 编译错误 测试结束
|
||||
if (data.status == 2 || data.status == -2 || tSeq >= tCount ){
|
||||
if (typeof cb == 'function') {cb(data); return;}
|
||||
if (typeof cb == 'function') {cb(data);$('#test-program-btn').show(); return;}
|
||||
$('#test-program-btn').show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -100,6 +104,7 @@ $(function(){
|
|||
} else {
|
||||
alert("对不起,服务器繁忙请稍后再试!");
|
||||
}
|
||||
$('#test-program-btn').show();
|
||||
return;
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue