试卷题的验证

dev_tj
cxt 5 years ago
parent e593c0d05e
commit 1fe5acad99

@ -182,7 +182,7 @@ class CoursesController < ApplicationController
CreateSubjectCourseStudentJob.perform_later(@course.id) if @course.subject && @course.subject.subject_appointments.count > 0
rescue => e
uid_logger_error(e.message)
tip_exception("调用失败")
tip_exception(e.message)
raise ActiveRecord::Rollback
end
end

@ -2,18 +2,9 @@ class ExerciseAnswersController < ApplicationController
before_action :require_login, :check_auth
before_action :get_exercise_question
include ExercisesHelper
# model validation error
rescue_from ActiveRecord::RecordInvalid do |ex|
render_error(ex.record.errors.full_messages.join(','))
end
# form validation error
rescue_from ActiveModel::ValidationError do |ex|
render_error(ex.model.errors.full_messages.join(','))
end
include ControllerRescueHandler
def create #每一次答案的点击,请求一次,实训题不在这里回答
begin
q_type = @exercise_question.question_type #试卷的类型
choice_id = params[:exercise_choice_id].present? ? params[:exercise_choice_id] : ""
answer_text = params[:answer_text].present? ? params[:answer_text].strip : "" #为字符串
@ -86,11 +77,6 @@ class ExerciseAnswersController < ApplicationController
end
normal_status(0,"回答成功")
end
rescue Exception => e
uid_logger_error(e.message)
tip_exception("页面调用失败!")
raise ActiveRecord::Rollback
end
end
private

Loading…
Cancel
Save