1、编程作业可以修改、删除
2、关闭匿评之后结束匿评按钮样式 3、编程作业成绩计算有问题 4、相关样式修改 5、编程作业作品展开界面功能
This commit is contained in:
parent
a8c5d18069
commit
4b83265508
|
@ -201,9 +201,7 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
if @homework.homework_type == 2 #编程作业,作品提交后不可以删除
|
||||
render_403
|
||||
elsif @work.destroy
|
||||
if @work.destroy
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
redirect_to student_work_index_url(:homework => @homework.id)
|
||||
|
@ -257,7 +255,6 @@ class StudentWorkController < ApplicationController
|
|||
when 3 #学生评分 学生评分显示平均分
|
||||
@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
|
||||
end
|
||||
set_final_score @homework,@work
|
||||
if @work.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
@ -2362,7 +2362,7 @@ module ApplicationHelper
|
|||
if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
|
||||
link_to "作品已交", "", :class => 'c_blue', :title => "开启匿评后不可修改作品"
|
||||
elsif homework.homework_type == 2 #编程作业不能修改作品
|
||||
link_to "作品已交", student_work_index_path(:homework => homework.id),:class => 'c_blue',:title => "编程作业不可修改作品"
|
||||
link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
|
||||
else
|
||||
link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue'
|
||||
end
|
||||
|
|
|
@ -31,7 +31,7 @@ class StudentWork < ActiveRecord::Base
|
|||
else
|
||||
self.system_score = last_test.test_score
|
||||
end
|
||||
self.final_score = self.system_score
|
||||
set_final_score self.homework_common,self
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -39,4 +39,102 @@ class StudentWork < ActiveRecord::Base
|
|||
self.description = last_test.src if last_test
|
||||
end
|
||||
|
||||
#成绩计算
|
||||
def set_final_score homework,student_work
|
||||
if homework && homework.homework_detail_manual
|
||||
if homework.homework_type == 1 #匿评作业
|
||||
if homework.teacher_priority == 1 #教师优先
|
||||
if student_work.teacher_score
|
||||
student_work.final_score = student_work.teacher_score
|
||||
else
|
||||
if student_work.teaching_asistant_score.nil?
|
||||
student_work.final_score = student_work.student_score
|
||||
elsif student_work.student_score.nil?
|
||||
student_work.final_score = student_work.teaching_asistant_score
|
||||
else
|
||||
ta_proportion = homework.homework_detail_manual.ta_proportion
|
||||
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
|
||||
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
|
||||
final_score = final_ta_score + final_s_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
end
|
||||
else #不考虑教师评分
|
||||
if student_work.teaching_asistant_score.nil?
|
||||
student_work.final_score = student_work.student_score
|
||||
elsif student_work.student_score.nil?
|
||||
student_work.final_score = student_work.teaching_asistant_score
|
||||
else
|
||||
ta_proportion = homework.homework_detail_manual.ta_proportion
|
||||
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
|
||||
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
|
||||
final_score = final_ta_score + final_s_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
end
|
||||
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
|
||||
if homework.teacher_priority == 1 #教师优先
|
||||
if student_work.teacher_score
|
||||
student_work.final_score = student_work.teacher_score
|
||||
else
|
||||
if student_work.teaching_asistant_score.nil? #教辅未评分
|
||||
if student_work.student_score.nil?
|
||||
student_work.final_score = student_work.system_score
|
||||
else
|
||||
ta_proportion = homework.homework_detail_programing.ta_proportion + homework.homework_detail_manual.ta_proportion / 2
|
||||
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
|
||||
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
|
||||
final_score = final_sy_score + final_st_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
elsif student_work.student_score.nil? #学生未评分
|
||||
if student_work.teaching_asistant_score.nil?
|
||||
student_work.final_score = student_work.system_score
|
||||
else
|
||||
ta_proportion = homework.homework_detail_programing.ta_proportion + (1.0 - homework.homework_detail_manual.ta_proportion - homework.homework_detail_programing.ta_proportion) / 2
|
||||
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
|
||||
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
|
||||
final_score = final_sy_score + final_ts_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
else
|
||||
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}")
|
||||
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}")
|
||||
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") - BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}"))
|
||||
final_score = final_sy_score + final_ts_score + final_st_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
end
|
||||
else #不考虑教师评分
|
||||
if student_work.teaching_asistant_score.nil? #教辅未评分
|
||||
if student_work.student_score.nil?
|
||||
student_work.final_score = student_work.system_score
|
||||
else
|
||||
ta_proportion = homework.homework_detail_programing.ta_proportion + homework.homework_detail_manual.ta_proportion / 2
|
||||
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
|
||||
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
|
||||
final_score = final_sy_score + final_st_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
elsif student_work.student_score.nil? #学生未评分
|
||||
if student_work.teaching_asistant_score.nil?
|
||||
student_work.final_score = student_work.system_score
|
||||
else
|
||||
ta_proportion = homework.homework_detail_programing.ta_proportion + (1.0 - homework.homework_detail_manual.ta_proportion - homework.homework_detail_programing.ta_proportion) / 2
|
||||
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
|
||||
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
|
||||
final_score = final_sy_score + final_ts_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
else
|
||||
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}")
|
||||
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}")
|
||||
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") - BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}"))
|
||||
final_score = final_sy_score + final_ts_score + final_st_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith('<span class="fr pr_join_span mr10" title="匿评结束">匿评结束</span>');
|
||||
$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith('<span class="postOptionLink" title="匿评结束">匿评结束</span>');
|
||||
alert('关闭成功');
|
|
@ -37,8 +37,8 @@
|
|||
|
||||
<% if @homework.homework_type == 2%>
|
||||
<!-- 系统评分 -->
|
||||
<li class="hworkList80 c_grey">
|
||||
<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
|
||||
<li class="hworkList80 <%= score_color student_work.system_score%>">
|
||||
<%= student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%>
|
||||
</li>
|
||||
<% end%>
|
||||
<li class="hworkList50 <%= score_color student_work.student_score%> student_score_info">
|
||||
|
|
|
@ -1,42 +1,56 @@
|
|||
<div class="show_hwork_arrow"></div>
|
||||
<div class="show_hwork">
|
||||
<div class="showHwork">
|
||||
<ul>
|
||||
<li class="fl" >
|
||||
<span class="tit_fb">
|
||||
上交时间:
|
||||
</span>
|
||||
<span class="tit_fb">上交时间:</span>
|
||||
<%=format_time @work.created_at %>
|
||||
</li>
|
||||
<% if @work.user != User.current%>
|
||||
<!-- 不是自己显示为点赞,编程作业不可编辑和删除 -->
|
||||
|
||||
<% if @work.user == User.current && @homework.homework_detail_manual.comment_status == 1 %>
|
||||
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
|
||||
<li class="fr" >
|
||||
<%= link_to("", student_work_path(@work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %>
|
||||
</li>
|
||||
<li class="fr" >
|
||||
<%= link_to "",new_student_work_path(:homework => @homework.id),:class => "pic_edit"%>
|
||||
</li>
|
||||
<% end%>
|
||||
<% if @homework.homework_detail_manual.comment_status == 3 && @work.user != User.current%>
|
||||
<!-- 匿评结束阶段,显示点赞按钮 -->
|
||||
<li class="fr" id="student_work_praise_<%= @work.id%>">
|
||||
<%= render :partial => 'student_work_praise' %>
|
||||
</li>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
|
||||
<li >
|
||||
<span class="tit_fb ">
|
||||
编程代码:
|
||||
</span>
|
||||
<div class="show_hwork_p break_word">
|
||||
<%= text_format @work.description%>
|
||||
<span class="tit_fb ">编程代码:</span>
|
||||
<div class="showHworkP break_word">
|
||||
<%= text_format(@work.description) if @work.description%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
||||
<% if @is_teacher%>
|
||||
<li>
|
||||
<li class="mt10 fl">
|
||||
<span class="tit_fb ">
|
||||
测试结果:
|
||||
</span>
|
||||
<div class="show_hwork_p break_word">
|
||||
<% @work.student_work_tests.each_with_index do |test, index| %>
|
||||
<div class="ProResultTop">
|
||||
<p class="c_blue fl">第<%= @work.student_work_tests.count - index%>次测试</p><span class="fr c_grey"><%= test.created_at.to_s(:db) %></span>
|
||||
<p class="c_blue fl">
|
||||
第<%= @work.student_work_tests.count - index%>次测试
|
||||
</p>
|
||||
<span class="fr c_grey">
|
||||
<%= test.created_at.to_s(:db) %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% if test.status.to_i == -2 %>
|
||||
<div class="ProResultCon "><%= test.results.first %></div>
|
||||
<div class="ProResultCon ">
|
||||
<%= test.results.first %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="ProResultTable " >
|
||||
<ul class="ProResultUl " >
|
||||
|
@ -46,9 +60,9 @@
|
|||
<% if x["status"].to_i != 0 %>
|
||||
<span class="w150 c_red">测试错误!</span>
|
||||
<span class="w60">您的输出:</span>
|
||||
<span class="W200"><%=x["result"]%></span>
|
||||
<span class="width150"><%=x["result"]%></span>
|
||||
<span class="w60">正确输出:</span>
|
||||
<span class="W200"><%=x["output"]%></span>
|
||||
<span class="width150"><%=x["output"]%></span>
|
||||
<div class="cl"></div>
|
||||
<% else %>
|
||||
<span class="w150 c_green">测试正确!</span>
|
||||
|
@ -62,21 +76,27 @@
|
|||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
<% end%>
|
||||
|
||||
<!-- 编程作业老师才可以评分 -->
|
||||
<li >
|
||||
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && @work.user != User.current )%>
|
||||
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
|
||||
<div id="add_student_score_<%= @work.id%>" class="mt10 evaluation">
|
||||
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
|
||||
</div>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="ping_box mt10" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
|
||||
<%@work.student_works_scores.order("updated_at desc").each do |score|%>
|
||||
<div class="ping_box fl" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
|
||||
<%@student_work_scores.each do |score|%>
|
||||
<div id="work_score_<%= score.id%>">
|
||||
<%= render :partial => 'student_work_score',:locals => {:score => score}%>
|
||||
<%= render :partial => 'student_work_score',:locals => {:score => score,:is_last => score == @student_work_scores.last}%>
|
||||
</div>
|
||||
<% end%>
|
||||
</div><!---ping_box end--->
|
||||
<a href="javascript:void(0);" class="fr c_blue mt5 mb5" onclick="$('#about_hwork_<%= @work.id%>').html('');">收起</a>
|
||||
</div>
|
||||
<!---ping_box end--->
|
||||
<a href="javascript:void(0);" class="fr linkBlue mt5 mb5" onclick="$('#about_hwork_<%= @work.id%>').html('');">收起</a>
|
||||
<div class="cl"></div>
|
||||
</div><!---show_hwork end--->
|
||||
</div>
|
|
@ -284,6 +284,7 @@ a:hover.tijiao{ background:#0f99a9;}
|
|||
.members_left ul li a{ float:left; text-align:center;}
|
||||
.members_left ul li span{ float:left; text-align:center; color:#484747;}
|
||||
.w150{ text-align:center; width:150px;min-height: 10px;}
|
||||
.width150{width:150px;min-height: 10px;}
|
||||
.f_b{ font-weight: bold;}
|
||||
.members_right label{ margin-left:15px;}
|
||||
.N_search{ height:20px; border:1px solid #999;}
|
||||
|
@ -692,7 +693,7 @@ a.hwork_center{ display:block; width:60px; text-align:center; margin-right:5px;}
|
|||
.show_hwork_arrow{ position:relative; top:2px; left:165px;background:url(../images/course/arrow_up.jpg) 0 0 no-repeat; width:20px; height:11px;}
|
||||
.tit_fb{ font-weight:bold; width:66px; text-align:right; display:block; float:left;}
|
||||
.ml160{ margin-left:160px;}
|
||||
.show_hwork_p{ width:580px; float:left;}
|
||||
.show_hwork_p{ width:630px; float:left;}
|
||||
.hwork_ping_text{ float:left; border:1px solid #e4e4e4; padding:5px; width:615px; height:35px;}
|
||||
.ping_box{ width:676px; padding:10px; background:#f5f3f3; }
|
||||
a.ping_pic{ display:block; width:34px; height:34px; padding:2px; border:1px solid #e3e3e3;}
|
||||
|
|
|
@ -1141,3 +1141,7 @@ a:hover.tijiao{ background:#0f99a9;}
|
|||
.c_pink{ color:#e65d5e;}
|
||||
.ni_con_work { width:300px; margin:25px 20px;}
|
||||
.ni_con_work p{ color:#808181; }
|
||||
|
||||
a.link_file_a{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; }
|
||||
a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
|
||||
.link_file_a{ display:block; max-width:450px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
|
Loading…
Reference in New Issue