|
|
|
@ -345,7 +345,7 @@ class ExerciseController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
elsif eq.question_type == 2
|
|
|
|
|
#多选题
|
|
|
|
|
ea = ExerciseAnswer.find_by_exercise_question_id_and_user_id(params[:exercise_question_id],User.current.id)
|
|
|
|
|
ea = ExerciseAnswer.find_by_exercise_choice_id_and_user_id(params[:exercise_choice_id],User.current.id)
|
|
|
|
|
if ea.nil?
|
|
|
|
|
#尚未答该题,添加答案
|
|
|
|
|
ea = ExerciseAnswer.new
|
|
|
|
@ -360,7 +360,7 @@ class ExerciseController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
#pv不为空,则当前选项之前已被选择,再次点击则是不再选择该项,故删除该答案
|
|
|
|
|
if pv.delete
|
|
|
|
|
if ea.delete
|
|
|
|
|
@percent = get_percent(@exercise, User.current)
|
|
|
|
|
render :json => {:text => "false" ,:percent => format("%.2f" , @percent)}
|
|
|
|
|
else
|
|
|
|
|