<%= @vote.title %>

<%= markdown(@vote.description) %>

<%= _("Candidates") %>

<% @vote.candidates.each do |candidate| %>

<%= candidate.name %>

<%= markdown(candidate.description) %>
<% end %>

<%= _("Results") %>

<% if @vote.ratings.blank? %> <%= _("No results are available because nobody voted on this vote.") %> <% else %> <% i = 0 %> <% @vote.candidates.sort { |a, b| a.mj <=> b.mj }.reverse.each do |candidate| %> <% i = i + 1 %> <% if i == 1 %> <% else %> <% end %> <% value = settings.values.select { |e| e[:id] == candidate.mj.mj }.first %> <% end %>
<%= _("Rank") %> <%= _("Candidate") %> <%= _("Majority Judgment") %> <%= _("Proponents") %> <%= _("Opponents") %>
<%= i %>
<%= i %><%= candidate.name %><%= _(value[:label]) %> <%= candidate.mj.proponents %> <%= candidate.mj.opponents %>
<% data = [] colors = [] settings.values.reverse.each do |v| d = { name: v[:label], data: [] } @vote.candidates.sort { |a, b| a.mj <=> b.mj }.reverse.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' %>

<%= _("Ratings") %>

<% @vote.candidates.each do |candidate| %> <% end %> <% @vote.ratings.collect { |rating| rating.user }.uniq.each do |user| %> <% @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 %> <% end %> <% end %> <% end %>
<%= _("Participant") %><%= candidate.name %>
<%= user.email %><%= _(value[:label]) %>
<% end %> <% if @vote.users.exists?(current_user.id) and @vote.expire_on.nil? %>
<% end %>

<%= _("Organizers") %>

<% if @vote.users.exists?(current_user.id) and @vote.expire_on.nil? %>

<%= _("Add organizer") %>

<% end %>