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