]> projects.mako.cc - selectricity/blobdiff - app/models/quick_vote.rb
Started Creation of "advanced" quickvote tab. Also started to create a quickvote...
[selectricity] / app / models / quick_vote.rb
index c0367d6b002ebc8f3058bc480c64edb61bbf3aa5..c04b0d7a3fe3a3539012ba45c50f4cc5632f2687 100644 (file)
@@ -5,6 +5,19 @@ class QuickVote < Election
   attr_accessor :raw_candidates
   attr_accessor :reviewed
   
+  def initialize(params={})
+    super
+    self.startdate = Time.now
+    self.active = 1
+    self.anonymous = 1 unless self.anonymous
+    self.enddate = read_attribute( :enddate ) || \
+                   Time.now + 30.days - 1.second
+  end
+  
+  def enddate
+    super(30)
+  end
+  
   def validate
     if not @raw_candidates or @raw_candidates.length < 2
       errors.add(nil, "You must list at least two candidates.")
@@ -35,14 +48,6 @@ class QuickVote < Election
       errors.add(:name, " is a reserved word.")
     end
   end
-  
-  def initialize(params={})
-    super
-    self.startdate = Time.now
-    self.enddate =  Time.now + 30.days
-    self.active = 1
-    self.anonymous = 1
-  end
 
   def candidatelist=(candlist)
     @raw_candidates = candlist

Benjamin Mako Hill || Want to submit a patch?