From: John Dong Date: Thu, 30 Aug 2007 23:13:09 +0000 (-0400) Subject: Merge head X-Git-Url: https://projects.mako.cc/source/selectricity/commitdiff_plain/f2db874f06622e5b7422dabc8e17396708277c56?hp=2658beb48f9c3310e84a2738b7c8293d4fc3dbd4 Merge head --- diff --git a/app/controllers/graph_controller.rb b/app/controllers/graph_controller.rb index b019aeb..413ebb0 100644 --- a/app/controllers/graph_controller.rb +++ b/app/controllers/graph_controller.rb @@ -108,14 +108,25 @@ class GraphController < ApplicationController @election.results unless @election.borda_result data, labels = get_borda_points(@election.borda_result) + size = "400x300" + size = "580x300" if @election.candidates.size >= 5 + + if @election.candidates.size >= 5 + marker_font_size = 17 + else + marker_font_size = 20 + end + graph = GruffGraff.new( :graph_type => Gruff::Bar, :data_name => @election.name, :data => data, :interval_labels => labels, + :size => size, :title => "Points Per Candidate", :marker_color => '#999999', + :marker_font_size => marker_font_size, :y_axis_label => "Points", - :x_axis_label => "Candidate") + :x_axis_label => "Candidates") send_data(*graph.output) end #Acording to Tufte, small, concomparitive, highly labeled data sets usually diff --git a/app/controllers/quickvote_controller.rb b/app/controllers/quickvote_controller.rb index a5c8065..da2903d 100644 --- a/app/controllers/quickvote_controller.rb +++ b/app/controllers/quickvote_controller.rb @@ -202,6 +202,7 @@ class QuickvoteController < ApplicationController @results = @election.results @candidates = {} @election.candidates.each {|c| @candidates[c.id] = c} + @names = @election.names_by_id @sidebar_content = render_to_string :partial => 'results_sidebar' end diff --git a/app/models/election.rb b/app/models/election.rb index ce7a0bc..99d64f9 100644 --- a/app/models/election.rb +++ b/app/models/election.rb @@ -23,7 +23,7 @@ class Election < ActiveRecord::Base def other_methods if election_method - @other_methods = ELECTION_TYPES.reject {|i| i == election_method} + @other_methods = ELECTION_TYPES.keys.reject {|i| i == election_method} else @other_methods = nil end diff --git a/app/views/quickvote/_approval_table.rhtml b/app/views/quickvote/_approval_table.rhtml new file mode 100644 index 0000000..85185ee --- /dev/null +++ b/app/views/quickvote/_approval_table.rhtml @@ -0,0 +1,15 @@ + + + + <% @election.approval_result.points.keys.sort.each do |candidate| %> + + <% end -%> + + + + + <% @election.approval_result.points.values.sort.each do |points| %> + + <% end -%> + +
Candidate<%=h @names[candidate] %>
Times Approved <%= points %>
\ No newline at end of file diff --git a/app/views/quickvote/_pref_tables.rhtml b/app/views/quickvote/_pref_tables.rhtml index 18e5aa3..628ce55 100644 --- a/app/views/quickvote/_pref_tables.rhtml +++ b/app/views/quickvote/_pref_tables.rhtml @@ -2,7 +2,6 @@ <% voters = @election.voters.size %> <% matrix = @election.condorcet_result.matrix %> <% victories = @election.condorcet_result.victories_and_ties %> -<% names = @election.names_by_id %> @@ -10,13 +9,13 @@ <% candidates.each do |candidate| -%> - <%=h names[candidate] -%> + <%=h @names[candidate] -%> <% end -%> <% candidates.each do |winner| -%> - <%=h names[winner] %> + <%=h @names[winner] %> <% candidates.each do |loser| -%> <% if winner == loser -%> -- @@ -36,10 +35,10 @@ <% candidates.each do |victor| %> - + <% victories[victor].keys.each do |loser| %> <% margin = victories[victor][loser]%> -
<%=h names[victor] %><%=h @names[victor] %><%=h names[loser] %> + <%=h @names[loser] %> <% if margin == 0%> Tied! <% else -%> diff --git a/app/views/quickvote/_result_approval.rhtml b/app/views/quickvote/_result_approval.rhtml index c93ce1d..a7e11ce 100644 --- a/app/views/quickvote/_result_approval.rhtml +++ b/app/views/quickvote/_result_approval.rhtml @@ -13,4 +13,6 @@ chooses. Approval voting is a limited form of range voting, where the range that voters are allowed to express is extremely constrained: accept or not.

- \ No newline at end of file + + +<%= render :partial => 'approval_table' %> \ No newline at end of file diff --git a/app/views/quickvote/create.rhtml b/app/views/quickvote/create.rhtml index 94081e6..c05424e 100644 --- a/app/views/quickvote/create.rhtml +++ b/app/views/quickvote/create.rhtml @@ -1,7 +1,6 @@ -
+
Quickvote Create New QuickVote -

@@ -26,9 +25,9 @@ <%= text_field 'quickvote', 'description', :size => 50 %>