|
|
|
@ -591,6 +591,10 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
# tip_exception("challenge_id参数的长度与challenge_score参数的长度不匹配") if
|
|
|
|
|
# params[:challenge_settings][:challenge_score].length != params[:challenge_settings][:challenge_id].length
|
|
|
|
|
|
|
|
|
|
sum_challenge_score = params[:challenge_settings].pluck(:challenge_score).reject(&:blank?).map{|score| score.to_f}.sum
|
|
|
|
|
total_score = params[:work_efficiency] ? (params[:eff_score].to_f + sum_challenge_score) : sum_challenge_score
|
|
|
|
|
tip_exception("分值之和必须等于总分值:#{params[:total_score]}分") if params[:total_score].to_f.round(2) != total_score.to_f.round(2)
|
|
|
|
|
|
|
|
|
|
current_eff_score = @homework.eff_score.to_f.round(2)
|
|
|
|
|
@homework.total_score = params[:total_score]
|
|
|
|
|
@homework.work_efficiency = params[:work_efficiency]
|
|
|
|
|