From 796f9d2f4d178419346feae82f3b3f7d30c5b2b2 Mon Sep 17 00:00:00 2001 From: Date: Mon, 20 Aug 2007 17:02:14 -0400 Subject: [PATCH] Added logic to pref_table.rhtml to prevent it from throwing an error on an empty results page. --- app/views/quickvote/_pref_table.rhtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/quickvote/_pref_table.rhtml b/app/views/quickvote/_pref_table.rhtml index 4576a0f..01de22b 100644 --- a/app/views/quickvote/_pref_table.rhtml +++ b/app/views/quickvote/_pref_table.rhtml @@ -1,6 +1,6 @@ <% candidates = @election.candidates.sort.collect {|candidate| candidate.id}-%> <% voters = @election.voters.size %> - +<% matrix = @election.condorcet_result.matrix %> <% names = Hash.new -%> <% candidates.each do |candidate| -%> <%names[candidate] = Candidate.find(candidate).name -%> @@ -17,8 +17,8 @@ <% candidates.each do |loser| -%> <% if winner == loser -%> -- - <% else %> - <% wins = @election.condorcet_result.matrix[winner][loser]%> + <% else %> + <% wins = matrix[winner][loser] unless matrix[winner].nil?%> <%= wins %> <%= sparkline_tag [(wins.to_f/voters.to_f)*100.0], :type => 'pie', :diameter => 25, :share_color => '#74ce00' %> -- 2.39.5