试卷调分的评语问题

dev_cs
SylorHuang 5 years ago
parent cbf0d74eea
commit a9c6367ac9

@ -497,6 +497,7 @@ class ExerciseQuestionsController < ApplicationController
ex_obj_score = @exercise_current_user.objective_score #全部客观题得分
ex_subj_score = @exercise_current_user.subjective_score < 0.0 ? 0.0 : @exercise_current_user.subjective_score #全部主观题得分
ex_answers = @exercise_question.exercise_answers.search_answer_users("user_id",@user_id) #当前用户答案的得分
ex_answer_create = nil
if @exercise_question.question_type == Exercise::MULTIPLE
if ex_answers.present? #学生有回答时 取学生的答题得分否则0分
answer_choice_array = []
@ -525,8 +526,8 @@ class ExerciseQuestionsController < ApplicationController
:score => @c_score,
:answer_text => ""
}
ex_answers = ExerciseAnswer.new(answer_option)
ex_answers.save
ex_answer_create = ExerciseAnswer.new(answer_option)
ex_answer_create.save
ex_answer_old = 0
end
if ex_obj_score <= 0.0
@ -636,13 +637,21 @@ class ExerciseQuestionsController < ApplicationController
question_comment.update_attributes(comment_option)
@exercise_comments = question_comment
else
if ex_answers.present?
ex_answer_comment_id = ex_answers.first.id
elsif ex_answer_create.present?
ex_answer_comment_id = ex_answer_create.id
else
ex_answer_comment_id = nil
end
comment_option = {
:user_id => current_user.id,
:comment => comments,
:score => @c_score,
:exercise_question_id => @exercise_question.id,
:exercise_shixun_answer_id => @shixun_a_id.present? ? @shixun_a_id : nil,
:exercise_answer_id => ex_answers.present? ? ex_answers.first.id : nil
:exercise_answer_id => ex_answer_comment_id
}
@exercise_comments = ExerciseAnswerComment.new(comment_option)
@exercise_comments.save

Loading…
Cancel
Save