X-Git-Url: https://projects.mako.cc/source/selectricity/blobdiff_plain/47fdfaba5a11570f2d7d720ee1c80d616d502c74..d2eb87b3ce3d10f0e8d490d5e248c657125a68a8:/app/views/quickvote/_pref_tables.rhtml diff --git a/app/views/quickvote/_pref_tables.rhtml b/app/views/quickvote/_pref_tables.rhtml index 66e0cbf..b9d41ec 100644 --- a/app/views/quickvote/_pref_tables.rhtml +++ b/app/views/quickvote/_pref_tables.rhtml @@ -1,23 +1,28 @@ -<% candidates = @election.condorcet_result.ranked_candidates.flatten -%> +<% candidates = @election.ssd_result.ranked_candidates.flatten -%> <% voters = @election.voters.size %> -<% matrix = @election.condorcet_result.matrix %> -<% victories = @election.condorcet_result.victories_and_ties %> -<% names = @election.names_by_id %> +<% matrix = @election.ssd_result.matrix %> +<% victories = @election.ssd_result.victories_and_ties %> +<% if candidates.size <= 7 -%> + +

Each number in the table below shows how many times the candidate on +the left beat the matching candidate on the top. The winner is on the +top of the left column.

- +
+
- + <% candidates.each do |candidate| -%> - + <% end -%> <% candidates.each do |winner| -%> - + <% candidates.each do |loser| -%> <% if winner == loser -%> @@ -32,23 +37,31 @@ <% end -%>
<%=h names[candidate] -%><%=h @names[candidate] -%>
<%=h names[winner] %><%=h @names[winner] %> --
- + - + +

A simplification of the above data. The winner is on the left; each +cell names the defeated candidate and the magnitude of the victory in +parenthesis.

+ +
+
<% candidates.each do |victor| %> - + <% victories[victor].keys.each do |loser| %> <% margin = victories[victor][loser]%> - + <% end -%> <% end -%>
<%=h names[victor] %><%=h @names[victor] %><%=h names[loser] %> + <%=h @names[loser] %> <% if margin == 0%> Tied! <% else -%> (<%= margin%>) <% end -%> -
+ +<% end -%>