在线测验的填空题未断网时报网络异常

This commit is contained in:
cxt 2015-12-30 15:49:16 +08:00
parent 9348cc9c24
commit e948c94300
1 changed files with 2 additions and 2 deletions

View File

@ -450,7 +450,7 @@ class ExerciseController < ApplicationController
if params[:answer_text].nil? || params[:answer_text].blank?
#用户提交空答案,视作不作答
@percent = get_percent(@exercise,User.current)
render :json => {:text => ea.answer_text,:percent => format("%.2f", @percent)}
render :json => {:text => "",:percent => format("%.2f", @percent)}
else
#添加答案
ea = ExerciseAnswer.new
@ -476,7 +476,7 @@ class ExerciseController < ApplicationController
# 用户提交空答案,视为删除答案
if ea.delete
@percent = get_percent(@exercise,User.current)
render :json => {:text => ea.answer_text,:percent => format("%.2f", @percent)}
render :json => {:text => "",:percent => format("%.2f", @percent)}
else
render :json => {:text => "failure"}
end