学生多选答题

This commit is contained in:
huang 2015-11-20 13:39:40 +08:00
parent 302dfaf933
commit 07ee819370
1 changed files with 2 additions and 2 deletions

View File

@ -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