Manage correctly results and stats for open-ended questions
Note that we are not including Poll::PartialResults for open-ended questions resutls. The reason is that we do not contemplate the possibility of there being open questions in booths. Manually counting and introducing the votes in the system is not feasible.
This commit is contained in:
@@ -1,25 +1,46 @@
|
||||
<h3 id="<%= question.title.parameterize %>"><%= question.title %></h3>
|
||||
<table id="question_<%= question.id %>_results_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<%- question.question_options.each do |option| %>
|
||||
<th scope="col" class="<%= option_styles(option) %>">
|
||||
<% if most_voted_option?(option) %>
|
||||
<span class="show-for-sr"><%= t("polls.show.results.most_voted_answer") %></span>
|
||||
<% end %>
|
||||
<%= option.title %>
|
||||
</th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<%- question.question_options.each do |option| %>
|
||||
<td id="option_<%= option.id %>_result" class="<%= option_styles(option) %>">
|
||||
<%= option.total_votes %>
|
||||
(<%= option.total_votes_percentage.round(2) %>%)
|
||||
<% if question.accepts_options? %>
|
||||
<thead>
|
||||
<tr>
|
||||
<%- question.question_options.each do |option| %>
|
||||
<th scope="col" class="<%= option_styles(option) %>">
|
||||
<% if most_voted_option?(option) %>
|
||||
<span class="show-for-sr"><%= t("polls.show.results.most_voted_answer") %></span>
|
||||
<% end %>
|
||||
<%= option.title %>
|
||||
</th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<%- question.question_options.each do |option| %>
|
||||
<td class="<%= option_styles(option) %>">
|
||||
<%= option.total_votes %>
|
||||
(<%= option.total_votes_percentage.round(2) %>%)
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</tbody>
|
||||
<% else %>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><%= t("polls.show.results.open_ended.valid") %></th>
|
||||
<th scope="col"><%= t("polls.show.results.open_ended.blank") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<%= question.open_ended_valid_answers_count %>
|
||||
(<%= question.open_ended_valid_percentage.round(2) %>%)
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</tbody>
|
||||
<td>
|
||||
<%= question.open_ended_blank_answers_count %>
|
||||
(<%= question.open_ended_blank_percentage.round(2) %>%)
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user