问卷的选项的内容

dev_aliyun_beta
SylorHuang 6 years ago
parent 141f99bb0f
commit c2a0a58e53

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

Loading…
Cancel
Save