Added method registration_dates_given?
This commit is contained in:
parent
a95a03c7e5
commit
f87cd94cb5
1 changed files with 16 additions and 2 deletions
|
|
@ -102,11 +102,25 @@ class Conference < ActiveRecord::Base
|
||||||
# * +true+ -> If today is in the registration period.
|
# * +true+ -> If today is in the registration period.
|
||||||
def registration_open?
|
def registration_open?
|
||||||
today = Date.current
|
today = Date.current
|
||||||
if self.registration_start_date.blank? || self.registration_end_date.blank?
|
if registration_dates_given?
|
||||||
|
(registration_start_date..registration_end_date).cover?(today)
|
||||||
|
else
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
(registration_start_date..registration_end_date).cover?(today)
|
##
|
||||||
|
# Checks if the registration dates for the conference are provided
|
||||||
|
#
|
||||||
|
# ====Returns
|
||||||
|
# * +false+ -> If the conference registration dates are not set
|
||||||
|
# * +true+ -> If conference registration dates are set
|
||||||
|
def registration_dates_given?
|
||||||
|
if self.registration_start_date.blank? || self.registration_end_date.blank?
|
||||||
|
false
|
||||||
|
else
|
||||||
|
true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue