]> projects.mako.cc - selectricity/commitdiff
create new open voter to allow open full elections
author<mako@atdot.cc> <>
Sat, 27 Dec 2008 14:23:11 +0000 (09:23 -0500)
committer<mako@atdot.cc> <>
Sat, 27 Dec 2008 14:23:11 +0000 (09:23 -0500)
app/controllers/election_controller.rb
app/controllers/voter_controller.rb
app/models/open_voter.rb [new file with mode: 0644]

index ccbbafe282bb2add4fc809c246f69a60b6bb04fb..3d811e622112f32ab59b6c5fc075a5a21d9c60da 100644 (file)
@@ -239,7 +239,7 @@ class ElectionController < ApplicationController
   end
   
   def delete_voter
-    voter = Voter.find( params[:id] )
+    voter = FullVoter.find( params[:id] )
     voter.destroy
   end
 
index 45b9a1a85f950cec5d54320942917be65071352c..d7f589db7f9d0b1d2e62d4806e11db686fd67ed3 100644 (file)
@@ -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 (file)
index 0000000..3e93561
--- /dev/null
@@ -0,0 +1,20 @@
+# Selectricity: Voting Machinery for the Masses
+# Copyright (C) 2007, 2008 Benjamin Mako Hill <mako@atdot.cc>
+# 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
+# <http://www.gnu.org/licenses/>.
+
+class OpenVoter < Voter
+end

Benjamin Mako Hill || Want to submit a patch?