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

dev_cs
杨树明 5 years ago
commit f8c00e0425

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

@ -3,7 +3,7 @@ class ExerciseAnswerComment < ApplicationRecord
belongs_to :user
belongs_to :exercise_question
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)}
end

@ -199,7 +199,7 @@ class ExerciseReviewAndAnswer extends Component{
result.data && result.data.exercise_questions.length>0 && result.data.exercise_questions.map((item,key)=>{
if( item.question_type == 4 && item.answer_status == 0 ){
ajustSore.push({
inputSore:undefined,
inputSore:0,
desc:undefined,
id:item.question_id,
position:item.q_position,
@ -276,7 +276,7 @@ class ExerciseReviewAndAnswer extends Component{
if(!obj){
ajustSore.push({
id,
inputSore:undefined,
inputSore:0,
desc:undefined,
position:position,
setTip:""

Loading…
Cancel
Save