<%= @vote.title %>
<% if @vote.expire_on %>
<%= _("Closing date: #{format_date(@vote.expire_on)}") %>
<% end %>
<%= @vote.description %>
<% if @vote.ratings.length > 0 %>
<%= _("All ratings") %>
| <%= _("Participant") %> |
<% @vote.candidates.each do |candidate| %>
<%= candidate.name %> |
<% end %>
<% @vote.ratings.collect { |rating| rating.user }.uniq.each do |user| %>
| <%= user.email %> |
<% @vote.candidates.each do |candidate| %>
<% if rating = @vote.ratings.find { |rating| rating.user == user and rating.candidate == candidate } %>
<% value = settings.values.select { |e| e[:id] == rating.value }.first %>
<%= value[:label] %> |
<% end %>
<% end %>
<% end %>
<%= _("Results") %>
| <%= _("Rank") %> |
<%= _("Candidate") %> |
<%= _("Majority Judgment") %> |
<%= _("Proponents") %> |
<%= _("Opponents") %> |
<% i = 0 %>
<% @vote.candidates.sort { |a, b| a.mj <=> b.mj }.reverse.each do |candidate| %>
<% i = i + 1 %>
| <%= i %> |
<%= candidate.name %> |
<% value = settings.values.select { |e| e[:id] == candidate.mj.mj }.first %>
<%= value[:label] %> |
<%= candidate.mj.proponents %> |
<%= candidate.mj.opponents %> |
<% end %>
<%
data = []
colors = []
settings.values.reverse.each do |v|
d = { name: v[:label], data: [] }
@vote.candidates.each do |c|
d[:data] << [c.name, c.mj.count[v[:id]]]
end
data << d
colors << v[:color]
end
%>
<%= bar_chart data, colors: colors, stacked: true, legend: 'bottom' %>
<% else %>
<%= _("Results") %>
<%= _("No results are available because nobody voted on this vote.") %>
<% end %>
<%= _("Organizers") %>
<% @vote.organizers.each do |organizer| %>
- <%= organizer.user.email %>
<% end %>
<% if @vote.users.exists?(current_user.id) and @vote.expire_on.nil? %>
<%= _("Actions for organizers") %>
<%= _("Add organizer") %>
<% end %>