Compare commits

..

No commits in common. "4ac2aeaf5ebe0e5b8beb7ddfa423099a50f81209" and "92a512be260c9e4eae2c0e7494b448644b79a6e1" have entirely different histories.

2 changed files with 29 additions and 58 deletions

View file

@ -18,30 +18,12 @@
} }
.mj-cell-<%= v[:id] %> { .mj-cell-<%= v[:id] %> {
border-left-width: 2px;
border-right-width: 2px;
border-color: <%= v[:color] %>;
background-color: <%= v[:color] %> !important; background-color: <%= v[:color] %> !important;
} }
<% end %> <% end %>
.tiebreak td { table:has(.mj-cell:hover) .mj-cell {
padding-left: 0; border-left-width: 2px;
padding-right: 0; border-right-width: 2px;
}
tr:has(.mj-cell:hover) .mj-cell {
border-color: var(--bs-body-color); border-color: var(--bs-body-color);
} }
tr:has(.mj-cell:hover) .mj-cell-majority {
background-color: white !important;
}
.tiebreak-top td {
border-bottom: 1px solid var(--bs-gray-400);
}
.tiebreak-round td {
padding-top: 15px;
}

View file

@ -85,65 +85,54 @@
<div class="col"><%= _("Votes for this candidate") %></div> <div class="col"><%= _("Votes for this candidate") %></div>
<div class="col text-end"><%= _("Votes for the winning candidate") %></div> <div class="col text-end"><%= _("Votes for the winning candidate") %></div>
</div> </div>
<table class="table table-borderless tiebreak"> <% n = 0 %>
<% n = 0 %> <% c.mj.break_tie(@results.first.mj).each do |a, b| %>
<% previous = 0 %> <hr>
<% max = @results.first.mj.n * 2 + 1 %> <% if n == 0 %>
<% c.mj.break_tie(@results.first.mj).each do |a, b| %> <div class="row">
<tr class="tiebreak-top"> <div class="col"><%= _("Without removing any vote.") %></div>
<td colspan="<%= max %>"></td> </div>
</tr> <% end %>
<tr class="tiebreak-round"> <% if n == 1 %>
<td colspan="<%= max %>"> <div class="row">
<% if n == 0 %> <div class="col"><%= _("Removing 1 vote.") %></div>
<%= _("Without removing any vote.") %> </div>
<% end %> <% end %>
<% if n == 1 %> <% if n > 1 %>
<% value = settings.values.select { |e| e[:id] == previous }.first %> <div class="row">
<%= _("Removing a vote of value: ") %> <div class="col"><%= _("Removing %{n} votes.") % { n: n } %></div>
<span class="badge bg-<%= value[:id] %>"><%= _(value[:label]) %></span> </div>
<% end %> <% end %>
<% if n > 1 %> <table class="table table-borderless">
<% value = settings.values.select { |e| e[:id] == previous }.first %>
<%= _("Removing another vote of value: ") %>
<span class="badge bg-<%= value[:id] %>"><%= _(value[:label]) %></span>
<% end %>
<% previous = a.mj %>
</td>
</tr>
<tr> <tr>
<% (1..a.n).each do |i| %> <% (1..a.n).each do |i| %>
<td class="p-0 text-center <% unless i == a.majority %>opacity-0<% end %>">↓</td> <td class="p-0 text-center <% unless i == a.majority %>opacity-0<% end %>">↓</td>
<% end %> <% end %>
<td colspan="<%= max - a.n - b.n %>"></td> <th></th>
<% (1..b.n).each do |i| %> <% (1..b.n).each do |i| %>
<td class="p-0 text-center <% unless b.n - i + 1 == b.majority %>opacity-0<% end %>">↓</td> <td class="p-0 text-center <% unless b.n - i + 1 == b.majority %>opacity-0<% end %>">↓</td>
<% end %> <% end %>
</tr> </tr>
<tr> <tr>
<% i = 0 %>
<% settings.values.reverse.each do |v| %> <% settings.values.reverse.each do |v| %>
<% (1..a.count[v[:id]]).each do |r| %> <% (1..a.count[v[:id]]).each do |r| %>
<% i = i + 1 %> <td class="p-0 mj-cell mj-cell-<%= v[:id] %>">&nbsp;</td>
<td class="p-0 mj-cell mj-cell-<%= v[:id] %><% if i == a.majority and a.mj == b.mj %> mj-cell-majority<% end %>">&nbsp;</td>
<% end %> <% end %>
<% end %> <% end %>
<td class="p-0 text-center fw-bold" colspan="<%= max - a.n - b.n %>"> <td class="p-0 text-center fw-bold">
<% if a.mj < b.mj %><<% end %> <% if a.mj < b.mj %><<% end %>
<% if a.mj > b.mj %>><% end %> <% if a.mj > b.mj %>><% end %>
<% if a.mj == b.mj %>=<% end %> <% if a.mj == b.mj %>=<% end %>
</td> </td>
<% i = 0 %>
<% settings.values.each do |v| %> <% settings.values.each do |v| %>
<% (1..b.count[v[:id]]).each do |r| %> <% (1..b.count[v[:id]]).each do |r| %>
<% i = i + 1 %> <td class="p-0 mj-cell mj-cell-<%= v[:id] %>">&nbsp;</td>
<td class="p-0 mj-cell mj-cell-<%= v[:id] %><% if b.n - i + 1 == b.majority and a.mj == b.mj %> mj-cell-majority<% end %>">&nbsp;</td>
<% end %> <% end %>
<% end %> <% end %>
</tr> </tr>
<% n = n + 1 %> </table>
<% end %> <% n = n + 1 %>
</table> <% end %>
</div> </div>
<% end %> <% end %>
</div> </div>