- @election = QuickVote.find_all( ["name = ?", params[:votename]] )[0]
-
- # initalize the tallies to empty arrays
- preference_tally = Array.new
- plurality_tally = Array.new
- approval_tally = Array.new
-
- @election.voters.each do |voter|
- # skip if the voter has not voted or has an unconfirmed vote
- next unless voter.voted?
-
- plurality_tally << voter.vote.rankings.sort[0].candidate.id
- approval_tally << voter.vote.rankings.sort[0..1].collect \
- { |ranking| ranking.candidate.id }
- preference_tally << voter.vote.rankings.sort.collect \
- { |ranking| ranking.candidate.id }
+ unless @election = QuickVote.ident_to_quickvote(params[:ident])
+ flash[:notice] = "Cannot find quickvote #{params[:ident]}."
+ redirect_to :controller => 'front'
+ return