问卷题的编辑和创建

chromesetting
cxt 5 years ago
parent 507c8f6a22
commit fb7815b2b6

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

Loading…
Cancel
Save