diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 73da3b9c4..3ed5886e7 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -359,7 +359,7 @@ class ExerciseController < ApplicationController if @exercise.end_time <= Time.now @course.student.each do |student| if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,@exercise.id).empty? - ExerciseUser.create(:user_id => student.student_id, :exercise_id => @exercise.id, :start_at => @exercise.end_time, :status => false,:score=>0) + ExerciseUser.create(:user_id => student.student_id, :exercise_id => @exercise.id, :start_at => @exercise.end_time, :status => true,:score=>0) end s_score = calculate_student_score(@exercise, student.student) @@ -577,15 +577,15 @@ class ExerciseController < ApplicationController standard_answer = get_user_standard_answer(question, user) unless answer.empty? # 问答题有多个答案 - if question.question_type == 3 + if question.question_type == 3 && !standard_answer.empty? if standard_answer.include?(answer.first.answer_text) score1 = score1+ question.question_score unless question.question_score.nil? end - elsif question.question_type == 1 + elsif question.question_type == 1 && !standard_answer.nil? if answer.first.exercise_choice.choice_position == standard_answer.exercise_choice_id score2 = score2 + question.question_score unless question.question_score.nil? end - else + elsif question.question_type == 2 && !standard_answer.nil? arr = get_mulscore(question, user) if arr.to_i == standard_answer.exercise_choice_id score3 = score3 + question.question_score unless question.question_score.nil? diff --git a/app/views/exercise/_exercise_teacher.html.erb b/app/views/exercise/_exercise_teacher.html.erb index 24687d28b..586c033a1 100644 --- a/app/views/exercise/_exercise_teacher.html.erb +++ b/app/views/exercise/_exercise_teacher.html.erb @@ -32,7 +32,7 @@