1. heliostatic
  2. compcomp

Commits

heliostatic  committed 14e0b04

fixing the competition

  • Participants
  • Parent commits 2e0c24f
  • Branches master

Comments (0)

Files changed (1)

File app/models/competition.rb

View file
 
   has_many :judge_submissions, :class_name => Submission.name, :conditions => {role: 2}
   has_many :judges, :through => :judge_submissions, :source => :user
-  
-  scope :expired, -> { where("deadline < ?", Date.today) }
-  scope :expiring_today, -> { where("deadline = ?", Date.today) }
-  scope :unexpired, -> { where("deadline >= ?", Date.today) }
+
+  scope :expired,         -> { where("deadline < ?", Date.today) }
+  scope :expiring_today,  -> { where("deadline = ?", Date.today) }
+  scope :unexpired,       -> { where("deadline >= ?", Date.today) }
 
   validates :title, :presence => true
   validates :owner, :presence => true
-  validates :deadline, :format => { :with => /\d{4}-\d{2}-\d{2}/,
-    :message => "Deadline must be YYYY-MM-DD" }
+  validates :deadline, :format => { :with => /\d{4}-\d{2}-\d{2}/, :message => "Deadline must be YYYY-MM-DD" }
   validates :deadline, :presence => true
-  validate :deadline_cannot_be_in_the_past
+  validate  :deadline_cannot_be_in_the_past
   validates :description, :presence => true
 
   after_save :create_sample_submission
         errors.add(:deadline, "The deadline can't be in the past.")
       end
     end
-end
+end