From a76088fe30a77e1883f634348c9979080838dc39 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Sat, 22 Jun 2019 14:04:45 +0800 Subject: [PATCH] fix bug --- app/controllers/exercise_questions_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/exercise_questions_controller.rb b/app/controllers/exercise_questions_controller.rb index 9e3259e6e..a0b88a97e 100644 --- a/app/controllers/exercise_questions_controller.rb +++ b/app/controllers/exercise_questions_controller.rb @@ -480,7 +480,7 @@ class ExerciseQuestionsController < ApplicationController ex_answers = @exercise_question.exercise_answers.search_answer_users("user_id",@user_id) #当前用户答案的得分 if @exercise_question.question_type == 3 #当为填空题,更新问题的总分, ex_answer_old = ex_answers.score_reviewed.pluck(:score).sum #每一关的得分总和 - each_right_score = (@c_score / ex_answers.count.to_f).round(1) #调分后,平均每关的分数 + each_right_score = (@c_score / ex_answers.count.to_f) #调分后,平均每关的分数 new_obj_score = ex_obj_score - ex_answer_old + @c_score total_scores = new_obj_score + ex_subj_score ex_scores = { @@ -615,7 +615,7 @@ class ExerciseQuestionsController < ApplicationController normal_status(-1,"题目不允许为空!") if (params[:question_title].blank? && params[:question_type].to_i !=5 ) #除了实训题,其余题目必需有题干 normal_status(-1,"问题类型不允许为空!" ) if params[:question_type].blank? normal_status(-1,"分值不允许为空!" ) if params[:question_score].blank? && params[:question_scores].blank? #分值的数组或参数必需存在一个 - if params[:question_score].present? && params[:question_score].to_f.round(1) <= 0.0 #问题类型存在,则分值不能为空,且必需大于0 + if params[:question_score].present? && params[:question_score].to_f <= 0.0 #问题类型存在,则分值不能为空,且必需大于0 normal_status(-1,"分值必需大于0!") elsif (params[:question_score].present? && params[:question_score].to_f.round(1) > 100.0) || (params[:question_scores].present? && (params[:question_scores].map{|a| a.to_f.round(1)}.max > 100.0)) normal_status(-1,"分值不能超过100分!") @@ -677,7 +677,7 @@ class ExerciseQuestionsController < ApplicationController end def check_adjust_score - @c_score = params[:score].to_f.round(1) #调分后的分数 + @c_score = params[:score].to_f #调分后的分数 @user_id = params[:user_id] @exercise_current_user = @exercise.exercise_users.exercise_commit_users(@user_id).first #当前试卷用户的答案内容 if @exercise_current_user.blank?