From c2a0a58e533028257074440334a0d639fdcc7792 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Thu, 29 Aug 2019 17:52:43 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=9A=84=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E7=9A=84=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/polls_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 0f301dd4f..022574045 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -901,9 +901,9 @@ class PollsController < ApplicationController error_question = [] @poll_multi_questions.each do |q| poll_user_votes = current_user.poll_votes.where(poll_question_id:q.id)&.size - if q.max_choices.present? && (poll_user_votes > q.max_choices) + if q.max_choices.present? && (q.max_choices > 0) && (poll_user_votes > q.max_choices) error_messages = "第#{q.question_number}题:超过最大选项限制" - elsif q.min_choices.present? && (poll_user_votes < q.min_choices) + elsif q.min_choices.present? && (q.min_choices > 0)&& (poll_user_votes < q.min_choices) error_messages = "第#{q.question_number}题:不得少于最小选项限制" else error_messages = nil