X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/adfcf4dd7d989d0560e2a8f6a590dd10c5a49a08..6ab290219a55a24ff6047d02cf6c9a03dc096195:/app/controllers/election_controller.rb diff --git a/app/controllers/election_controller.rb b/app/controllers/election_controller.rb index 94c203d..571b936 100644 --- a/app/controllers/election_controller.rb +++ b/app/controllers/election_controller.rb @@ -76,13 +76,18 @@ class ElectionController < ApplicationController :locals => { :page => 'review' } @election = Election.find(params[:id]) + if @election.type == QuickVote + redirect_to(:controller => 'quickvote', :action => 'index', :ident => @election.id) + end + end def start_election @election = Election.find(params[:id]) + @election.voters.each do |voter| voter.vote = Vote.new - email_voter voter + email_voter voter unless voter.email.nil? end @election.activate! @@ -168,7 +173,7 @@ class ElectionController < ApplicationController def results @election = Election.find( params[:id] ) votes = [] - + @election.voters.each do |voter| if voter.vote and voter.vote.confirmed? votes << voter.vote.rankings.sort.collect {|vote| vote.candidate_id} @@ -181,6 +186,7 @@ class ElectionController < ApplicationController @candidates_by_id = {} @election.candidates.each {|cand| @candidates_by_id[cand.id] = cand} + end def detailed_results @@ -189,7 +195,8 @@ class ElectionController < ApplicationController @voter_list = [] @vote_list = [] - @election.voters. each do |voter| + + @election.voters.each do |voter| if voter.vote and voter.vote.confirmed? @voter_list << voter.email @vote_list << voter.vote