Fix bug.
This commit is contained in:
parent
8766770119
commit
9f3a4fb528
|
@ -133,18 +133,20 @@ class Act
|
|||
end
|
||||
|
||||
def can_sign_up?
|
||||
(self.sign_up && (self.sign_start_date.blank? || self.sign_start_date <= time_now) && ( self.sign_end_date.blank? || self.sign_end_date >= time_now )) rescue false
|
||||
@time_now ||= Time.now
|
||||
(self.sign_up && (self.sign_start_date.blank? || self.sign_start_date <= @time_now) && ( self.sign_end_date.blank? || self.sign_end_date >= @time_now )) rescue false
|
||||
end
|
||||
|
||||
def is_external_link?
|
||||
self.is_external_link && !self.external_link.blank?
|
||||
end
|
||||
def signup_show
|
||||
@time_now ||= Time.now
|
||||
if self.can_sign_up?
|
||||
sign_up = ('<a href="'+ (self.is_external_link? ? self.external_link : OrbitHelper.url_to_show(self.to_param)) + '" target="_blank">' + I18n.t('act.sign_up') + '</a>').html_safe
|
||||
elsif self.sign_up
|
||||
sign_up = I18n.t('act.sign_up_not_open')
|
||||
elsif (self.sign_start_date > time_now rescue false)
|
||||
elsif (self.sign_start_date > @time_now rescue false)
|
||||
sign_up = I18n.t('act.sign_up_not_yet')
|
||||
else
|
||||
sign_up = I18n.t('act.sign_up_overdue')
|
||||
|
|
Loading…
Reference in New Issue