<%= @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}" %> <%= erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == c.mj.mj }.first } %>

<%= 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 %> <% previous = nil %> <% max = @results.first.mj.n * 2 + 1 %> <% c.mj.break_tie(@results.first.mj).each do |a, b| %> <% (1..a.n).each do |i| %> <% end %> <% (1..b.n).each do |i| %> <% end %> <% i = 0 %> <% settings.values.reverse.each do |v| %> <% (1..a.count[v[:id]]).each do |r| %> <% i = i + 1 %> <% end %> <% end %> <% i = 0 %> <% settings.values.each do |v| %> <% (1..b.count[v[:id]]).each do |r| %> <% i = i + 1 %> <% end %> <% end %> <% n = n + 1 %> <% end %>
<% if n == 0 %> <% current = erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == a.mj }.first } %> <%= _("Without removing any vote, both candidates have the same majority judgement of %{current}.") % { current: current } %> <% end %> <% if n == 1 %> <% if a.mj == b.mj %> <% current = erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == a.mj }.first } %> <%= _("Removing a vote of rating %{previous}, both candidates still have the same majority judgement of %{current}.") % { previous: previous, current: current } %> <% else %> <% losing = erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == a.mj }.first } %> <% winning = erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == b.mj }.first } %> <%= _("Removing a vote of rating %{previous}, this candidate has a majority judgement of %{losing}, but the winning candidate has a majority judgement of %{winning}.") % { previous: previous, losing: losing, winning: winning } %> <% end %> <% end %> <% if n > 1 %> <% if a.mj == b.mj %> <% current = erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == a.mj }.first } %> <%= _("Removing another vote of rating %{previous}, both candidates still have the same majority judgement of %{current}.") % { previous: previous, current: current } %> <% else %> <% losing = erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == a.mj }.first } %> <% winning = erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == b.mj }.first } %> <%= _("Removing another vote of rating %{previous}, this candidate has a majority judgement of %{losing}, but the winning candidate has a majority judgement of %{winning}.") % { previous: previous, losing: losing, winning: winning } %> <% end %> <% end %> <% previous = erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == a.mj }.first } %>
  <% if a.mj < b.mj %><<% end %> <% if a.mj > b.mj %>><% end %> <% if a.mj == b.mj %>=<% 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 } %> <% end %> <% end %> <% end %>
<%= _("Participant") %><%= candidate.name %>
<%= user.email %> <%= erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == rating.value }.first } %>
<% 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 %>