<%= @vote.title %>

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

<%= _("Results") %>

<% if @vote.ratings.blank? %> <%= _("No results are available because nobody voted on this vote.") %> <% else %> <% r = 0 %> <% @results = @vote.candidates.sort { |a, b| a.mj <=> b.mj }.reverse %> <% @results.each do |c| %> <% r = r + 1 %>
<% if r == 1 %>

<%= _("Winning candidate") %>

<%= _("The winning candidate is the candidate with the highest median vote (↓), called majority judgment.") %>

<% end %>

<%= "##{r}" %> <% value = settings.values.select { |e| e[:id] == c.mj.mj }.first %> <%= _(value[:label]) %>

<%= c.name %>

<% (1..c.mj.n).each do |i| %> <% end %> <% settings.values.reverse.each do |v| %> <% (1..c.mj.count[v[:id]]).each do |r| %> <% end %> <% end %>
 

<% if r > 1 and c.mj.mj == @results.first.mj.mj %> <% end %>

<%= markdown(c.description) %>
<% if r > 1 and c.mj.mj == @results.first.mj.mj %>

<%= _("This candidate and the winning candidate have the same majority judgment.") %>

<%= _("To break the tie, we remove the vote that corresponds to the majority judgment one-by-one until one candidate has a better majority judgment than the other.") %>

<%= _("Votes for this candidate") %>
<%= _("Votes for the winning candidate") %>
<% n = 0 %> <% c.mj.break_tie(@results.first.mj).each do |a, b| %>
<% if n == 0 %>
<%= _("Without removing any vote.") %>
<% end %> <% if n == 1 %>
<%= _("Removing 1 vote.") %>
<% end %> <% if n > 1 %>
<%= _("Removing %{n} votes.") % { n: n } %>
<% end %> <% (1..a.n).each do |i| %> <% end %> <% (1..b.n).each do |i| %> <% end %> <% settings.values.reverse.each do |v| %> <% (1..a.count[v[:id]]).each do |r| %> <% end %> <% end %> <% settings.values.each do |v| %> <% (1..b.count[v[:id]]).each do |r| %> <% end %> <% end %>
  <% if a.mj < b.mj %><<% end %> <% if a.mj > b.mj %>><% end %> <% if a.mj == b.mj %>=<% end %>  
<% n = n + 1 %> <% end %>
<% end %>
<% end %>

<%= _("Ratings") + " (#{@vote.ratings.collect { |rating| rating.user }.uniq.count})" %>

<% @vote.candidates.each do |candidate| %> <% end %> <% @vote.ratings.collect { |rating| rating.user }.uniq.sort_by { |user| user.email }.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 %>