From 3587b33a81a7640f15a40d89ef8fce98199541d5 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 26 Jun 2019 18:52:11 +0800 Subject: [PATCH] fixbug --- app/helpers/exercises_helper.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 9ea7578f2..e0db9c2bf 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -13,7 +13,8 @@ module ExercisesHelper ques_score = q.exercise_answers.search_answer_users("user_id",user_id).score_reviewed.pluck(:score).sum end - if ques_score == q.question_score #满分作答为正确 + if ques_score >= q.question_score #满分作答为正确 + ques_score = q.question_score stand_answer = 1 elsif ques_score > 0.0 #部分作答 stand_answer = 2 @@ -35,7 +36,8 @@ module ExercisesHelper exercise_sub_status.each do |s| sub_answer = s.exercise_answers.search_answer_users("user_id",user_id) #主观题只有一个回答 if sub_answer.present? && sub_answer.first.score >= 0.0 - if s.question_score == sub_answer.first.score + + if s.question_score <= sub_answer.first.score stand_status = 1 else stand_status = 2