学生多选答题
This commit is contained in:
parent
302dfaf933
commit
07ee819370
|
@ -345,7 +345,7 @@ class ExerciseController < ApplicationController
|
||||||
end
|
end
|
||||||
elsif eq.question_type == 2
|
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?
|
if ea.nil?
|
||||||
#尚未答该题,添加答案
|
#尚未答该题,添加答案
|
||||||
ea = ExerciseAnswer.new
|
ea = ExerciseAnswer.new
|
||||||
|
@ -360,7 +360,7 @@ class ExerciseController < ApplicationController
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
#pv不为空,则当前选项之前已被选择,再次点击则是不再选择该项,故删除该答案
|
#pv不为空,则当前选项之前已被选择,再次点击则是不再选择该项,故删除该答案
|
||||||
if pv.delete
|
if ea.delete
|
||||||
@percent = get_percent(@exercise, User.current)
|
@percent = get_percent(@exercise, User.current)
|
||||||
render :json => {:text => "false" ,:percent => format("%.2f" , @percent)}
|
render :json => {:text => "false" ,:percent => format("%.2f" , @percent)}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue