|
|
@ -899,7 +899,7 @@ class PollsController < ApplicationController
|
|
|
|
@poll_multi_questions = @poll.poll_questions.where(question_type:2).select(:id,:max_choices,:min_choices,:question_number)
|
|
|
|
@poll_multi_questions = @poll.poll_questions.where(question_type:2).select(:id,:max_choices,:min_choices,:question_number)
|
|
|
|
error_question = []
|
|
|
|
error_question = []
|
|
|
|
@poll_multi_questions.each do |q|
|
|
|
|
@poll_multi_questions.each do |q|
|
|
|
|
poll_user_votes = current_user.poll_votes.where(question_id:q.id)&.size
|
|
|
|
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? && (poll_user_votes > q.max_choices)
|
|
|
|
error_messages = "第#{q.question_number}题:超过最大选项限制"
|
|
|
|
error_messages = "第#{q.question_number}题:超过最大选项限制"
|
|
|
|
elsif q.min_choices.present? && (poll_user_votes < q.min_choices)
|
|
|
|
elsif q.min_choices.present? && (poll_user_votes < q.min_choices)
|
|
|
|