]> projects.mako.cc - selectricity-live/blobdiff - app/views/quickvote/_pref_table.rhtml
list_quickvotes XMLRPC returns candidate ID's instead of names
[selectricity-live] / app / views / quickvote / _pref_table.rhtml
index dfcb6cca9ea31438ad480ce56b8814761743b1b8..32f5de4bc81254afef3a36fbae12a82ab331d21b 100644 (file)
@@ -1,13 +1,17 @@
-<% candidates = @election.candidates.sort.collect {|candidate| candidate.id} -%>
+<% candidates = @election.candidates.sort.collect {|candidate| candidate.id}-%>
+<% names = Hash.new -%>
+<% candidates.each do |candidate| -%>
+       <%names[candidate] = Candidate.find(candidate).name -%>
+<% end -%>
 <table class="voterbox">
   <tr>
        <td> </td>
        <% candidates.each do |candidate| -%>
-         <th><%= candidate -%></th>
+         <th><%= names[candidate] -%></th>
        <% end -%>
 <% candidates.each do |winner| -%>
   <tr>
-       <th><%= winner %></th>
+       <th><%= names[winner] %></th>
   <% candidates.each do |loser| -%> 
     <% if winner == loser -%>
       <td> -- </td>
@@ -16,4 +20,5 @@
     <% end -%>
   <% end -%>
  </tr>
-<%end -%>
\ No newline at end of file
+<% end -%>
+

Benjamin Mako Hill || Want to submit a patch?