Added support for voting in QuickVotes.
[selectricity] / app / models / election.rb
index 69038e473946ceddd9a2a23e5fe7dae7571ba31f..0860a426ff137d84dc9184ac322725aec05553cf 100644 (file)
@@ -21,5 +21,27 @@ class Election < ActiveRecord::Base
     end
     super
   end
+
+  def start_blockers
+    reasons = []
+    
+    if self.candidates.length <= 1
+      reasons << "You must have at least two candidates."
+    end
+    
+    if self.voters.length <= 1
+      reasons << "You must have at least two voters."
+    end
+
+    reasons
+  end
+
+  def activate!
+    self.active = 1
+  end
   
+  def quickvote?
+    quickvote.to_i == 1
+  end
+
 end

Benjamin Mako Hill || Want to submit a patch?