Removes answerable/non_answerable questions in polls
Now they are either all answerable or non-answerable, so it is not worth it to make the distinction in code
This commit is contained in:
@@ -9,8 +9,7 @@ class PollsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@answerable_questions = @poll.questions.answerable_by(current_user).for_render.sort_for_list
|
@questions = @poll.questions.for_render.sort_for_list
|
||||||
@non_answerable_questions = @poll.questions.where.not(id: @answerable_questions.map(&:id)).for_render.sort_for_list
|
|
||||||
|
|
||||||
@answers_by_question_id = {}
|
@answers_by_question_id = {}
|
||||||
poll_partial_results = Poll::PartialResult.by_question(@poll.question_ids).by_author(current_user.try(:id))
|
poll_partial_results = Poll::PartialResult.by_question(@poll.question_ids).by_author(current_user.try(:id))
|
||||||
|
|||||||
@@ -35,21 +35,7 @@
|
|||||||
|
|
||||||
<div class="row margin-top">
|
<div class="row margin-top">
|
||||||
<div class="small-12 medium-9 column">
|
<div class="small-12 medium-9 column">
|
||||||
<% @answerable_questions.each do |question| %>
|
<% @questions.each do |question| %>
|
||||||
<%= render 'polls/questions/question', question: question %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if can?(:answer, @poll) &&
|
|
||||||
@non_answerable_questions.present? %>
|
|
||||||
<div class="callout warning margin-top">
|
|
||||||
<h2 class="questions-callout">
|
|
||||||
<%= t("polls.show.cant_answer_wrong_geozone",
|
|
||||||
count: @non_answerable_questions.count) %>
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% @non_answerable_questions.each do |question| %>
|
|
||||||
<%= render 'polls/questions/question', question: question %>
|
<%= render 'polls/questions/question', question: question %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user