From f850a71b59599a0f0e038bdabc5e3f047c5bae16 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 18 Nov 2015 15:30:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/exercise_helper.rb | 11 +++++++++++ app/views/exercise/_exercise_form.html.erb | 17 +++++++++-------- app/views/exercise/_new_MC.html.erb | 16 ++++++++-------- app/views/exercise/_new_MCQ.html.erb | 18 +++++++++--------- .../exercise/create_exercise_question.js.erb | 1 + 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb index 2c92ffad7..4cafa8e62 100644 --- a/app/helpers/exercise_helper.rb +++ b/app/helpers/exercise_helper.rb @@ -43,4 +43,15 @@ module ExerciseHelper return result end + def get_current_score exercise + score = 0 + unless exercise.nil? + exercise.exercise_questions.each do |exercise_question| + score += exercise_question.question_score + end + return score + end + return score + end + end \ No newline at end of file diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb index 8567c6641..61e288079 100644 --- a/app/views/exercise/_exercise_form.html.erb +++ b/app/views/exercise/_exercise_form.html.erb @@ -76,21 +76,21 @@ '