diff options
-rw-r--r-- | lib/registration.rb | 7 | ||||
-rw-r--r-- | registration.rb | 11 |
2 files changed, 8 insertions, 10 deletions
diff --git a/lib/registration.rb b/lib/registration.rb index 6afe8b6..bebe326 100644 --- a/lib/registration.rb +++ b/lib/registration.rb @@ -1,5 +1,6 @@ require_relative 'band' require_relative 'pdf_form' +require 'date' require 'mail' def send_registration_emails_for(band, pdf_url) @@ -30,3 +31,9 @@ end def create_pdf_file_name(band) filename = "#{Date.today.iso8601}-#{sanitize(band.name)}-#{sanitize(band.city)}.pdf" end + +def accept_registrations(settings) + start_date = Date.parse(settings.accept_registrations[:start]) + end_date = Date.parse(settings.accept_registrations[:stop]) + start_date <= Date.today && end_date > Date.today +end diff --git a/registration.rb b/registration.rb index 8501a37..e85fc47 100644 --- a/registration.rb +++ b/registration.rb @@ -13,17 +13,8 @@ class RegistrationApp < Sinatra::Base config_file File.join(settings.root, 'config.yml') - - helpers do - def accept_registrations - start_date = Date.parse(settings.accept_registrations[:start]) - end_date = Date.parse(settings.accept_registrations[:stop]) - start_date <= Date.today && end_date > Date.today - end - end - get '/' do - if !accept_registrations + if !accept_registrations(settings) return erb :registration_closed end |