编程作业,最终评分的计算

This commit is contained in:
sw 2015-07-09 10:38:44 +08:00
parent 8f3ac85fec
commit eb1976efbb
1 changed files with 4 additions and 2 deletions

View File

@ -190,8 +190,10 @@ class StudentWorkController < ApplicationController
if @work.student_score.nil?
@work.final_score = @work.teaching_asistant_score
else
final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}")
final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}"))
ta_proportion = @homework.homework_detail_manual.ta_proportion if @homework.homework_detail_manual
ta_proportion = @homework.homework_detail_programing.ta_proportion if @homework.homework_detail_programing
final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_ta_score + final_s_score
@work.final_score = format("%.2f",final_score.to_f)
end