Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

dev_cs
杨树明 5 years ago
commit e426011189

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

Loading…
Cancel
Save