Implements event submissions over time chart

This commit is contained in:
Chrisbr 2014-05-30 10:10:47 +02:00
parent b6538cddb2
commit 40c61ed717
12 changed files with 215 additions and 9 deletions

View file

@ -7,4 +7,20 @@ class CallForPapers < ActiveRecord::Base
validates_presence_of :start_date, :end_date, :hard_deadline
validates :rating, :numericality => { :greater_than_or_equal_to => 0, :less_than_or_equal_to => 10 }
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
end