1、缺评、迟交扣分

2、匿评提示框、最终成绩计算提示框
3、修改作业
This commit is contained in:
sw 2015-07-03 10:47:10 +08:00
parent 1e12b68027
commit 642fa8dd5d
7 changed files with 85 additions and 13 deletions

View File

@ -91,15 +91,37 @@ class HomeworkCommonController < ApplicationController
@homework.end_time = params[:homework_common][:end_time]
@homework.publish_time = params[:homework_common][:publish_time]
@homework.homework_type = params[:homework_common][:homework_type]
@homework.late_penalty = params[:late_penalty]
unless @homework.late_penalty == params[:late_penalty]
@homework.student_works.where("late_penalty != 0").each do |student_work|
student_work.late_penalty = params[:late_penalty]
student_work.save
end
@homework.late_penalty = params[:late_penalty]
end
@homework.course_id = @course.id
#匿评作业相关属性
@homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
@homework_detail_manual.evaluation_start = params[:evaluation_start]
@homework_detail_manual.evaluation_end = params[:evaluation_end]
@homework_detail_manual.evaluation_num = params[:evaluation_num]
@homework_detail_manual.absence_penalty = params[:absence_penalty]
if @homework.homework_type == 1
@homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
@homework_detail_manual.evaluation_start = params[:evaluation_start]
@homework_detail_manual.evaluation_end = params[:evaluation_end]
@homework_detail_manual.evaluation_num = params[:evaluation_num]
unless @homework_detail_manual.absence_penalty == params[:absence_penalty]
if @homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
@homework.student_works.where("absence_penalty != 0").each do |student_work|
student_work.absence_penalty = student_work.absence_penalty / @homework_detail_manual.absence_penalty * params[:absence_penalty].to_i
student_work.save
end
end
@homework_detail_manual.absence_penalty = params[:absence_penalty]
end
else #不是匿评作业缺评扣分为0分每个作品的缺评扣分改为0分防止某些作业在结束匿评之后改为普通作业
@homework.student_works.where("absence_penalty != 0").each do |student_work|
student_work.late_penalty = 0
student_work.save
end
@homework_detail_manual.absence_penalty = 0
end
@homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@homework)

View File

@ -42,6 +42,7 @@ class StudentWorkController < ApplicationController
end
end
@homework_commons = @course.homework_commons.order("created_at desc")
@homework_commons = @course.homework_commons.order("created_at desc")
@score = @b_sort == "desc" ? "asc" : "desc"
respond_to do |format|
format.html

View File

@ -39,8 +39,33 @@
<% end%>
</li>
<% score = student_work.respond_to?("score") ? student_work.score : student_work.final_score - student_work.absence_penalty - student_work.late_penalty%>
<li class=" hwork_score <%= score_color score%>">
<li class=" hwork_score <%= score_color score%> student_final_scor_info">
<%= score.nil? ? "--" : format("%.1f",score)%>
<% unless score.nil?%>
<% if @homework.homework_type == 1%>
<!-- 匿评作品显示缺评扣分 -->
<div class="info_ni">
作品最终评分为
<span class="c_red">&nbsp;<%= student_work.final_score%>&nbsp;</span>分。
迟交扣分
<span class="c_red">&nbsp;<%= student_work.late_penalty%>&nbsp;</span>分,
缺评扣分
<span class="c_red">&nbsp;<%= student_work.absence_penalty%>&nbsp;</span>分,
最终成绩为
<span class="c_red">&nbsp;<%= score%>&nbsp;</span>分。
</div>
<% else%>
<!-- 非匿评作品不显示缺评扣分 -->
<div class="info_ni">
作品最终评分为
<span class="c_red">&nbsp;<%= student_work.final_score%>&nbsp;</span>分。
迟交扣分
<span class="c_red">&nbsp;<%= student_work.late_penalty%>&nbsp;</span>分,
最终成绩为
<span class="c_red">&nbsp;<%= score%>&nbsp;</span>分。
</div>
<% end%>
<% end%>
</li>
<div class="cl"></div>
</ul><!---hwork_ul end-->

View File

@ -16,14 +16,26 @@ $("#score_list_<%= @work.id%>").removeAttr("style");
$(function(){
//匿评评分提示
$(".student_score_info").bind("mouseover",function(e){
//alert($(this).html());
$(this).find("div").show();
$(this).find("div").css("top",e.pageY);
$(this).find("div").css("left",e.pageX);
// $(this).find("div").css("top",e.pageY);
// $(this).find("div").css("left",e.pageX);
});
$(".student_score_info").bind("mouseout",function(e){
//alert($(this).html());
$(this).find("div").hide();
});
//最终成绩提示
$(".student_final_scor_info").bind("mouseover",function(e){
//alert($(this).html());
$(this).find("div").show();
// $(this).find("div").css("top",e.pageY);
// $(this).find("div").css("left",e.pageX);
});
$(".student_final_scor_info").bind("mouseout",function(e){
//alert($(this).html());
$(this).find("div").hide();
});
});

View File

@ -60,7 +60,7 @@
<%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %>
<% end%>
<div class="info_ni">
<div class="info_ni_download">
使用
<span class="c_red">winzip</span>
工具进行解压可能会导致

View File

@ -788,13 +788,24 @@ $(function(){
$(".student_score_info").bind("mouseover",function(e){
//alert($(this).html());
$(this).find("div").show();
$(this).find("div").css("top",e.pageY);
$(this).find("div").css("left",e.pageX);
//$(this).find("div").css("top",e.pageY);
//$(this).find("div").css("left",e.pageX);
});
$(".student_score_info").bind("mouseout",function(e){
//alert($(this).html());
$(this).find("div").hide();
});
//最终成绩提示
$(".student_final_scor_info").bind("mouseover",function(e){
//alert($(this).html());
$(this).find("div").show();
//$(this).find("div").css("top",e.pageY);
//$(this).find("div").css("left",e.pageX);
});
$(".student_final_scor_info").bind("mouseout",function(e){
//alert($(this).html());
$(this).find("div").hide();
});
$("#about_project label").eq(1).remove();

View File

@ -654,7 +654,8 @@ a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px;
a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;}
.fr{ float:right;}
.li_min_search{ float:right; margin-right:-10px;}
.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 200px;margin-top: 10px;}
.info_ni_download{ width:100px; padding:5px;position: fixed;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 200px;margin-top: 10px;}
.info_ni{ width:100px; padding:5px;position: fixed;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 50px;margin-top: -5px;}
/*返回顶部*/
.to_top{width: 19px;height: 74px;position: fixed;top: 50px;right: 1px;color: white;background: #15bccf; line-height: 1.2; padding-top: 10px;padding-left: 5px;font-size: 14px;cursor: pointer;}
.hwork_num_ab{ width:120px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}