From 23ada9377f3af4e022fde14057c8bfeacbfb38e3 Mon Sep 17 00:00:00 2001 From: ricola Date: Wed, 21 Jan 2026 09:17:38 -0600 Subject: [PATCH] Explain each round of tiebreaker with a full sentence --- views/votes_show_closed.erb | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/views/votes_show_closed.erb b/views/votes_show_closed.erb index d4355e5..f06b740 100644 --- a/views/votes_show_closed.erb +++ b/views/votes_show_closed.erb @@ -86,7 +86,7 @@ <% n = 0 %> - <% previous = 0 %> + <% previous = nil %> <% max = @results.first.mj.n * 2 + 1 %> <% c.mj.break_tie(@results.first.mj).each do |a, b| %> @@ -95,17 +95,30 @@
<% 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 %> <% if n == 1 %> - <%= _("Removing a vote of rating: ") %> - <%= erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == previous }.first } %> + <% 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 %> - <%= _("Removing another vote of rating: ") %> - <%= erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == previous }.first } %> + <% 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 = a.mj %> + <% previous = erb :rating_badge, :locals => { :value => settings.values.select { |e| e[:id] == a.mj }.first } %>