]> projects.mako.cc - selectricity-live/blobdiff - app/models/vote.rb
added numbering back to embeddables, should count correctly no matter how many candid...
[selectricity-live] / app / models / vote.rb
index bb91a6b53a84e07e3d4034eb8776c59c2e8ebbbb..bef35020a45b1a7d37ca25fdd86dec73259f8ab5 100644 (file)
@@ -69,13 +69,9 @@ class Vote < ActiveRecord::Base
     rankings.each { |ranking| ranking.destroy }
   end
 
     rankings.each { |ranking| ranking.destroy }
   end
 
-  def settime
-    self.time = Time.now
-    self.save
-  end
-
   def confirm!
     self.confirmed = 1
   def confirm!
     self.confirmed = 1
+    self.time = Time.now
     self.save
     
     unless self.voter.election.quickvote?
     self.save
     
     unless self.voter.election.quickvote?
@@ -105,7 +101,7 @@ class Vote < ActiveRecord::Base
   # too. It creates a vote with the candidates listed in order of preference 
   # based on alphabetical order. Meant to be manipulated and then confirmed
   def set_defaults!  
   # too. It creates a vote with the candidates listed in order of preference 
   # based on alphabetical order. Meant to be manipulated and then confirmed
   def set_defaults!  
-    self.votes = voter.election.candidates.sort.collect {|c| c.id }
+    self.votes = self.voter.election.candidates.sort_by { rand }.collect {|c| c.id }
     self.save
   end
          
     self.save
   end
          

Benjamin Mako Hill || Want to submit a patch?