Fix bug.
This commit is contained in:
parent
e9f409a0f9
commit
40e0029fee
|
@ -131,25 +131,25 @@ class Act
|
|||
statuses << {"name" => hidden_text, "classname" => "hidden"} if is_hidden?
|
||||
statuses
|
||||
end
|
||||
|
||||
def can_sign_up?
|
||||
@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)
|
||||
sign_up = I18n.t('act.sign_up_not_yet')
|
||||
time_now = Time.now
|
||||
if self.sign_up
|
||||
sign_start_date_checked = (self.sign_start_date.nil? || self.sign_start_date <= time_now)
|
||||
sign_end_date_checked = (self.sign_end_date.nil? || self.sign_end_date >= time_now)
|
||||
if sign_start_date_checked && sign_end_date_checked
|
||||
sign_up_text = ('<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 !sign_start_date_checked
|
||||
sign_up_text = I18n.t('act.sign_up_not_yet')
|
||||
else
|
||||
sign_up_text = I18n.t('act.sign_up_overdue')
|
||||
end
|
||||
else
|
||||
sign_up = I18n.t('act.sign_up_overdue')
|
||||
sign_up_text = I18n.t('act.sign_up_not_open')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue