From 8b29002a0fdf30058186869621b7e0bdbc69920b Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 20 Nov 2015 20:02:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=97=E5=88=86=E8=A7=84?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 28f532db6..c15d5ad23 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -21,6 +21,10 @@ class ExerciseController < ApplicationController end def show + unless User.current.member_of_course?(@course) + render_403 + return + end @exercise = Exercise.find params[:id] @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? if @exercise.exercise_status != 2 && (!User.current.allowed_to?(:as_teacher,@course) || User.current.admin?) @@ -485,16 +489,16 @@ class ExerciseController < ApplicationController # 问答题有多个答案 if question.question_type == 3 if standard_answer.include?(answer.first.answer_text) - score1 = score+ question.question_score unless question.question_score.nil? + score1 = score1+ question.question_score unless question.question_score.nil? end elsif question.question_type == 1 if answer.first.exercise_choice.choice_position == standard_answer.exercise_choice_id - score2 = score + question.question_score unless question.question_score.nil? + score2 = score2 + question.question_score unless question.question_score.nil? end else arr = get_mulscore(question, user) if arr.to_i == standard_answer.exercise_choice_id - score3 = score + question.question_score unless question.question_score.nil? + score3 = score3 + question.question_score unless question.question_score.nil? end # ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id) # arr = []