试卷第一次调分评语没有出现

dev_cs
SylorHuang 5 years ago
parent f3f29b7a9c
commit cbf0d74eea

@ -525,7 +525,8 @@ class ExerciseQuestionsController < ApplicationController
:score => @c_score, :score => @c_score,
:answer_text => "" :answer_text => ""
} }
ExerciseAnswer.create(answer_option) ex_answers = ExerciseAnswer.new(answer_option)
ex_answers.save
ex_answer_old = 0 ex_answer_old = 0
end end
if ex_obj_score <= 0.0 if ex_obj_score <= 0.0
@ -625,7 +626,7 @@ class ExerciseQuestionsController < ApplicationController
@exercise_current_user.update_attributes(ex_scores) @exercise_current_user.update_attributes(ex_scores)
end end
comments = params[:comment] comments = params[:comment]
question_comment = @exercise_question.exercise_answer_comments.first question_comment = @exercise_question.exercise_answer_comments&.first
if question_comment.present? if question_comment.present?
comment_option = { comment_option = {
:comment => comments.present? ? comments : question_comment.comment, :comment => comments.present? ? comments : question_comment.comment,

@ -3,7 +3,7 @@ class ExerciseAnswerComment < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :exercise_question belongs_to :exercise_question
belongs_to :exercise_shixun_answer, optional: true belongs_to :exercise_shixun_answer, optional: true
belongs_to :exercise_answer,optional: true belongs_to :exercise_answer, optional: true
scope :search_answer_comments, lambda {|name,ids| where("#{name}":ids)} scope :search_answer_comments, lambda {|name,ids| where("#{name}":ids)}
end end

Loading…
Cancel
Save