From 418077c59ae0d1086417b4a2e0bb5b9fa1f93ef3 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Mon, 24 Jun 2019 20:42:09 +0800 Subject: [PATCH] fix bug --- .../_exercise_questions.json.jbuilder | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/views/exercise_questions/_exercise_questions.json.jbuilder b/app/views/exercise_questions/_exercise_questions.json.jbuilder index 04806540f..afba34c9b 100644 --- a/app/views/exercise_questions/_exercise_questions.json.jbuilder +++ b/app/views/exercise_questions/_exercise_questions.json.jbuilder @@ -82,15 +82,16 @@ elsif question.question_type == 5 json.shixun_details do json.array! shixun_challenges do |s| - - exercise_cha_score = nil - game = Game.user_games(ex_answerer.id,s.challenge_id).first - if game.present? - if game.status == 2 && game.final_score >= 0 - exercise_cha_score = s.question_score #每一关卡的得分 - end - end - json.exercise_cha_socre exercise_cha_score + # + # exercise_cha_score = nil + # game = Game.user_games(ex_answerer.id,s.challenge_id).first + # if game.present? + # if game.status == 2 && game.final_score >= 0 + # exercise_cha_score = s.question_score #每一关卡的得分 + # end + # end + user_shixun_score = s.exercise_shixun_answers.where(user_id:ex_answerer.id,exercise_question_id:question.id) + json.exercise_cha_socre user_shixun_score.present? ? user_shixun_score.first.score : -1 games_score = shixun_game_scores(s,ex_answerer,shixun_type,question.id) user_get_score = games_score[:s_score].present? ? games_score[:s_score] : 0.0