]> projects.mako.cc - selectricity/blobdiff - app/views/quickvote/_pref_tables.rhtml
fixed up the results page in a number of ways
[selectricity] / app / views / quickvote / _pref_tables.rhtml
index 0d2b020f654c6de57a5f145d009da14c28e8d5d8..b9d41ececcb6b2738dbc639ddf4785956eca4915 100644 (file)
@@ -1,22 +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 -%>
+
+<p>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.</p>
 
 <!-- This table shows how many times each choice was ranked above the other, 
        with percentages-->
-<table class="voterbox">
+<div class="result_table">
+<table class="preftable">
   <tr>
-       <td> </td>
+       <td></td>
        <% candidates.each do |candidate| -%>
-         <th><%=h names[candidate] -%></th>
+         <th><%=h @names[candidate] -%></th>
   <% end -%>
  </tr>
 
 <% candidates.each do |winner| -%>
   <tr>
-       <th><%=h names[winner] %></th>
+       <th><%=h @names[winner] %></th>
   <% candidates.each do |loser| -%> 
     <% if winner == loser -%>
       <td> -- </td>
  </tr>
 <% end -%>
 </table>
-
+</div>
 <!-- This table generates a margin of victory -->
-<table class="voterbox">
+
+<p>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.</p>
+
+<div class="result_table">
+<table class="preftable">
   <% candidates.each do |victor| %>
   <tr>
-    <th><%=h names[victor] %></th>
+    <th><%=h @names[victor] %></th>
        <% victories[victor].keys.each do |loser| %>
        <% margin = victories[victor][loser]%>
-       <td><%=h names[loser] %> 
+       <td><%=h @names[loser] %> 
            <% if margin == 0%>
                  Tied!
                <% else -%>
@@ -50,3 +62,6 @@
   </tr>
   <% end -%>
 </table>
+</div>
+<% end -%>
+

Benjamin Mako Hill || Want to submit a patch?