Explain each round of tiebreaker with a full sentence

This commit is contained in:
ricola 2026-01-21 09:17:38 -06:00
parent 079ce2d2c1
commit 23ada9377f

View file

@ -86,7 +86,7 @@
</div> </div>
<table class="table table-borderless tiebreak"> <table class="table table-borderless tiebreak">
<% n = 0 %> <% n = 0 %>
<% previous = 0 %> <% previous = nil %>
<% max = @results.first.mj.n * 2 + 1 %> <% max = @results.first.mj.n * 2 + 1 %>
<% c.mj.break_tie(@results.first.mj).each do |a, b| %> <% c.mj.break_tie(@results.first.mj).each do |a, b| %>
<tr class="tiebreak-top"> <tr class="tiebreak-top">
@ -95,17 +95,30 @@
<tr class="tiebreak-round"> <tr class="tiebreak-round">
<td colspan="<%= max %>"> <td colspan="<%= max %>">
<% if n == 0 %> <% if n == 0 %>
<%= _("Without removing any vote.") %> <% 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 %> <% end %>
<% if n == 1 %> <% if n == 1 %>
<%= _("Removing a vote of rating: ") %> <% if a.mj == b.mj %>
<%= erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == previous }.first } %> <% 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 %> <% end %>
<% if n > 1 %> <% if n > 1 %>
<%= _("Removing another vote of rating: ") %> <% if a.mj == b.mj %>
<%= erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == previous }.first } %> <% 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 %> <% end %>
<% previous = a.mj %> <% previous = erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == a.mj }.first } %>
</td> </td>
</tr> </tr>
<tr> <tr>