osem-fcy/app/models/call_for_papers.rb

27 lines
671 B
Ruby
Raw Normal View History

2013-01-07 09:04:09 +01:00
class CallForPapers < ActiveRecord::Base
2014-05-14 16:37:19 +02:00
attr_accessible :start_date, :end_date, :hard_deadline,
:description, :schedule_changes, :rating,
:schedule_public
2013-01-07 09:04:09 +01:00
belongs_to :conference
validates_presence_of :start_date, :end_date, :hard_deadline
validates :rating, :numericality => { :greater_than_or_equal_to => 0, :less_than_or_equal_to => 10 }
2013-01-07 09:04:09 +01:00
def self.max_weeks
all = CallForPapers.all
result = [0]
all.each do |cfp|
result.push(cfp.end_week - cfp.start_week)
end
result.max
end
def start_week
start_date.strftime('%W').to_i
end
def end_week
end_date.strftime('%W').to_i
end
2013-08-16 16:09:29 +03:00
end