|
|
@ -235,9 +235,9 @@ class PollQuestionsController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def validates_params
|
|
|
|
def validates_params
|
|
|
|
normal_status(-1, "问题标题不能为空!") if params[:question_title].blank?
|
|
|
|
normal_status(-1, "题目不能为空!") if params[:question_title].blank?
|
|
|
|
normal_status(-1, "是否要求必答的值不能为空!") if params[:is_necessary].blank?
|
|
|
|
normal_status(-1, "是否要求必答的值不能为空!") if params[:is_necessary].blank?
|
|
|
|
normal_status(-1, "问题类型不能为空!") if params[:question_type].blank?
|
|
|
|
normal_status(-1, "题目类型不能为空!") if params[:question_type].blank?
|
|
|
|
if params[:min_choices].present? && params[:max_choices].present? && (params[:min_choices].to_i > params[:max_choices].to_i)
|
|
|
|
if params[:min_choices].present? && params[:max_choices].present? && (params[:min_choices].to_i > params[:max_choices].to_i)
|
|
|
|
normal_status(-1, "最小可选不能大于最大可选!")
|
|
|
|
normal_status(-1, "最小可选不能大于最大可选!")
|
|
|
|
elsif params[:question_answers].present? && (params[:max_choices].to_i > params[:question_answers].count)
|
|
|
|
elsif params[:question_answers].present? && (params[:max_choices].to_i > params[:question_answers].count)
|
|
|
|