修改得分规则

This commit is contained in:
huang 2015-11-20 20:02:57 +08:00
parent c0dfc17b19
commit 8b29002a0f
1 changed files with 7 additions and 3 deletions

View File

@ -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 = []