From: Date: Sat, 27 Dec 2008 14:23:11 +0000 (-0500) Subject: create new open voter to allow open full elections X-Git-Url: https://projects.mako.cc/source/selectricity/commitdiff_plain/3130bc1c24f60ec0db68ef9a8e996ecae6eac385?ds=sidebyside;hp=98bb7b88caea42148d7ebd72e408f523bcac4f96 create new open voter to allow open full elections --- diff --git a/app/controllers/election_controller.rb b/app/controllers/election_controller.rb index ccbbafe..3d811e6 100644 --- a/app/controllers/election_controller.rb +++ b/app/controllers/election_controller.rb @@ -239,7 +239,7 @@ class ElectionController < ApplicationController end def delete_voter - voter = Voter.find( params[:id] ) + voter = FullVoter.find( params[:id] ) voter.destroy end diff --git a/app/controllers/voter_controller.rb b/app/controllers/voter_controller.rb index 45b9a1a..d7f589d 100644 --- a/app/controllers/voter_controller.rb +++ b/app/controllers/voter_controller.rb @@ -27,11 +27,11 @@ class VoterController < ApplicationController if params[:election_id] @election = Election.find(params[:election_id]) unless @election.authenticated? - @voter = Voter.find(:all, + @voter = OpenVoter.find(:all, :conditions => ["session_id = ? and election_id = ?", session.session_id, @election.id])[0] - @voter = Voter.new unless @voter + @voter = OpenVoter.new unless @voter @voter.election = @election @voter.session_id = session.session_id @@ -53,7 +53,7 @@ class VoterController < ApplicationController @voter.vote = Vote.new @voter.save end - + @voter.vote.set_defaults! if @voter.vote.rankings.empty? # if the election is now finished @@ -194,7 +194,7 @@ class VoterController < ApplicationController if password == "open" election = Election.find(params[:format]) unless election.authenticated? - @voter = Voter.find(:all, + @voter = OpenVoter.find(:all, :conditions => ["session_id = ? and election_id = ?", session.session_id, election.id])[0] @password = "open." + election.id.to_s diff --git a/app/models/open_voter.rb b/app/models/open_voter.rb new file mode 100644 index 0000000..3e93561 --- /dev/null +++ b/app/models/open_voter.rb @@ -0,0 +1,20 @@ +# Selectricity: Voting Machinery for the Masses +# Copyright (C) 2007, 2008 Benjamin Mako Hill +# Copyright (C) 2007 Massachusetts Institute of Technology +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . + +class OpenVoter < Voter +end