|
|
|
@ -526,8 +526,7 @@ class ExerciseQuestionsController < ApplicationController
|
|
|
|
|
:score => @c_score,
|
|
|
|
|
:answer_text => ""
|
|
|
|
|
}
|
|
|
|
|
ex_answer_create = ExerciseAnswer.new(answer_option)
|
|
|
|
|
ex_answer_create.save
|
|
|
|
|
ExerciseAnswer.new(answer_option)
|
|
|
|
|
ex_answer_old = 0
|
|
|
|
|
end
|
|
|
|
|
if ex_obj_score <= 0.0
|
|
|
|
@ -628,23 +627,18 @@ class ExerciseQuestionsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
comments = params[:comment]
|
|
|
|
|
question_comment = @exercise_question.exercise_answer_comments&.first
|
|
|
|
|
|
|
|
|
|
if question_comment.present?
|
|
|
|
|
comment_option = {
|
|
|
|
|
:comment => comments.present? ? comments : question_comment.comment,
|
|
|
|
|
:score => @c_score,
|
|
|
|
|
:exercise_answer_id => ex_answers.present? ? ex_answers.first.id : nil
|
|
|
|
|
:exercise_answer_id => ex_answers.present? ? ex_answers.first.id : nil,
|
|
|
|
|
:user_id => current_user.id
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
ex_answer_comment_id = @exercise_question.exercise_answers.find_by(user_id: @user_id).try(:id)
|
|
|
|
|
comment_option = {
|
|
|
|
|
:user_id => current_user.id,
|
|
|
|
|
:comment => comments,
|
|
|
|
|