]> projects.mako.cc - selectricity-live/blobdiff - app/models/election.rb
Merge from jdong
[selectricity-live] / app / models / election.rb
index 0907e68a4cfc7e5796ef9920bbfca09a4b0cd0bd..cf7bba58a2974f409a2828226d4dd43dc2f023ac 100644 (file)
@@ -10,7 +10,7 @@ class Election < ActiveRecord::Base
   def startdate
     read_attribute( :startdate ) || Time.now
   end
-
+  
   def enddate
     date = read_attribute( :enddate ) || Time.now + 14
     date - 1.second
@@ -22,6 +22,14 @@ class Election < ActiveRecord::Base
     super(date)
   end
 
+  def votes
+    votes = Array.new
+    self.voters.each do |voter|
+      votes << voter.vote
+    end
+    return votes
+  end
+
   def destroy
     self.candidates.each do |candidate|
       candidate.destroy
@@ -49,7 +57,7 @@ class Election < ActiveRecord::Base
   end
   
   def quickvote?
-    quickvote.to_i == 1
+    type == 'QuickVote'
   end
 
   def active?

Benjamin Mako Hill || Want to submit a patch?