From 4b7d59e8da8a4edaf3d05e490f20ab8e3556244f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 20 Nov 2019 16:44:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=88=E7=8E=87=E5=88=86=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 062e4877f..55b184ba0 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -577,8 +577,8 @@ class HomeworkCommonsController < ApplicationController tip_exception("缺少answer_open_evaluation参数") if params[:answer_open_evaluation].nil? tip_exception("缺少work_efficiency参数") if params[:work_efficiency].nil? tip_exception("缺少eff_score参数") if params[:work_efficiency] && params[:eff_score].blank? - tip_exception("效率分不能小于等于0") if params[:eff_score] && params[:eff_score].to_i <= 0 - tip_exception("效率分不能大于总分值") if params[:eff_score] && params[:eff_score].to_i > params[:total_score].to_i + tip_exception("效率分不能小于等于0") if params[:eff_score] && params[:eff_score].to_f <= 0 + tip_exception("效率分不能大于总分值") if params[:eff_score] && params[:eff_score].to_f.round(2) > params[:total_score].to_f.round(2) tip_exception("缺少shixun_evaluation参数") if params[:shixun_evaluation].blank? tip_exception("缺少challenge_settings参数") if params[:challenge_settings].blank? # tip_exception("缺少challenge_id参数") if params[:challenge_settings][:challenge_id].blank? @@ -586,12 +586,12 @@ class HomeworkCommonsController < ApplicationController # tip_exception("challenge_id参数的长度与challenge_score参数的长度不匹配") if # params[:challenge_settings][:challenge_score].length != params[:challenge_settings][:challenge_id].length - current_eff_score = @homework.eff_score + current_eff_score = @homework.eff_score.to_f.round(2) @homework.total_score = params[:total_score] @homework.work_efficiency = params[:work_efficiency] - @homework.eff_score = params[:work_efficiency] ? params[:eff_score].to_i : 0 + @homework.eff_score = params[:work_efficiency] ? params[:eff_score].to_f.round(2) : 0 - update_eff_score = current_eff_score != @homework.eff_score + update_eff_score = current_eff_score.round(2) != @homework.eff_score.round(2) if @homework_detail_manual.answer_open_evaluation != params[:answer_open_evaluation] @homework_detail_manual.answer_open_evaluation = params[:answer_open_evaluation]