diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 3c3a42b69..7a3b2b6c2 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -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 diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index 6808f8cfe..399e8355e 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -40,15 +40,16 @@ <%= calendar_for('homework_publish_time')%>
-
-
  • +
  • <%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>  分
  • + +

    编程评测设置