confused Condorcet and the Schulze Method for QuickVotes
@plurality_result = PluralityVote.new(plurality_tally).result
@approval_result = ApprovalVote.new(approval_tally).result
@plurality_result = PluralityVote.new(plurality_tally).result
@approval_result = ApprovalVote.new(approval_tally).result
- @condorcet_result = CloneproofSSDVote.new(preference_tally).result
- @ssd_result = PureCondorcetVote.new(preference_tally).result
+ @condorcet_result = PureCondorcetVote.new(preference_tally).result
+ @ssd_result = CloneproofSSDVote.new(preference_tally).result
@borda_result = BordaVote.new(preference_tally).result
@runoff_result = InstantRunoffVote.new(preference_tally).result
@borda_result = BordaVote.new(preference_tally).result
@runoff_result = InstantRunoffVote.new(preference_tally).result
+ # create a mapping of candidates ids and the relative order of the
+ # candidates as they appear when sorted alphabetically
+ cand_relnums = {}
+ self.voter.election.candidates.sort.each_with_index do |c, i|
+ cand_relnums[c.id] = i + 1
+ end
+
+ # assemble the votestring
+ self.votes.collect {|v| cand_relnums[v]}.join("")
end
# the following subroutine is used for quickvotes. it creates a vote
end
# the following subroutine is used for quickvotes. it creates a vote
:url => { :action => 'add_candidate' } %>
<p>
<%= text_field "ajax", "newcandidate", :size => 40 %>
:url => { :action => 'add_candidate' } %>
<p>
<%= text_field "ajax", "newcandidate", :size => 40 %>
- <%= submit_tag "Add" %>
+ <%= submit_tag "Add(+)" %>
<%= form_tag :action => 'create' %>
<!--[form:election]-->
<%= form_tag :action => 'create' %>
<!--[form:election]-->
-<p><label for="quickvote_name">Super-short name (for URL)<br />
+<p><label for="quickvote_name">One Word Description (for URL)<br />
<em><font size="-1">required; 5-12 characters; only letters and numbers; no spaces</font></em></label><br/>
<em><font size="-1">required; 5-12 characters; only letters and numbers; no spaces</font></em></label><br/>
# config.active_record.observers = :cacher, :garbage_collector
# Make Active Record use UTC-base instead of local time
# config.active_record.observers = :cacher, :garbage_collector
# Make Active Record use UTC-base instead of local time
- # config.active_record.default_timezone = :utc
+ config.active_record.default_timezone = :utc
# See Rails::Configuration for more options
end
# See Rails::Configuration for more options
end