1、编程作业迟交扣分的显示

2、修改编程作业时的错误
This commit is contained in:
sw 2015-07-06 16:28:33 +08:00
parent 1ea972d030
commit 23f6941001
2 changed files with 8 additions and 6 deletions

View File

@ -136,7 +136,7 @@ class HomeworkCommonController < ApplicationController
# @homework.course_id = @course.id
#匿评作业相关属性
if @homework.homework_type == 1
if @homework.homework_type == 1 && @homework_detail_manual
@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]
@ -152,15 +152,15 @@ class HomeworkCommonController < ApplicationController
end
@homework_detail_manual.absence_penalty = params[:absence_penalty]
end
else #不是匿评作业缺评扣分为0分每个作品的缺评扣分改为0分防止某些作业在结束匿评之后改为普通作业
elsif @homework.homework_type == 0 #普通作业缺评扣分为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
@homework_detail_manual.absence_penalty = 0 if @homework_detail_manual
end
if @homework.homework_type == 2 #编程作业
if @homework.homework_type == 2 && @homework_detail_programing #编程作业
@homework_detail_programing.language = "C++"
@homework_detail_programing.standard_code = params[:standard_code]
homework_tests = @homework.homework_tests
@ -293,6 +293,7 @@ class HomeworkCommonController < ApplicationController
def find_homework
@homework = HomeworkCommon.find params[:id]
@homework_detail_manual = @homework.homework_detail_manual
@homework_detail_programing = @homework.homework_detail_programing
@course = @homework.course
rescue
render_404

View File

@ -40,15 +40,16 @@
<%= calendar_for('homework_publish_time')%>
<div class="cl"></div>
</li>
<div class="cl"></div>
<li style="display: none;">
<li>
<label class="label02">迟交扣分:&nbsp;</label>
<%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
<span class="fl mt5">&nbsp;分</span>
<div class="cl"></div>
</li>
</ul><!--hwork_new_basic end--->
<div class="cl"></div>
<div class="hwork_new_set">
<p class="fl ml20 f14 mb10 c_orange">编程评测设置</p>
<div class="cl"></div>