|
|
|
@ -247,9 +247,9 @@ class PollQuestionsController < ApplicationController
|
|
|
|
|
elsif params[:question_type] == 3 && (params[:question_answers] || params[:question_other_answer])
|
|
|
|
|
normal_status(-1, "主观问题不需要可选答案!")
|
|
|
|
|
elsif params[:question_type] != 3
|
|
|
|
|
if params[:question_answers].present? && params[:question_answers].include?("")
|
|
|
|
|
normal_status(-1, "选择题不能有空值!")
|
|
|
|
|
elsif params[:question_other_answer].present? && params[:question_other_answer].length > 0
|
|
|
|
|
if params[:question_answers].present? && params[:question_answers].select{|answer| answer.blank?}.count > 0
|
|
|
|
|
normal_status(-1, "选项不能有空值!")
|
|
|
|
|
elsif params[:question_other_answer].present? && !params[:question_other_answer].blank?
|
|
|
|
|
normal_status(-1, "其他选项不能有值!")
|
|
|
|
|
elsif params[:question_type] == 1 && params[:question_answers].count < 2
|
|
|
|
|
normal_status(-1, "单选题选项不能小于2!")
|
|
|
|
|