Fix can_display for status ordering and hidden
This commit is contained in:
parent
af6e7d5ac5
commit
b5962ea4bf
|
@ -34,6 +34,8 @@ class Bulletin
|
||||||
|
|
||||||
before_destroy :destroy_email
|
before_destroy :destroy_email
|
||||||
|
|
||||||
|
scope :can_display, ->{where(:is_hidden=>false).any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil}).order_by([:is_top, :desc])}
|
||||||
|
|
||||||
def update_user
|
def update_user
|
||||||
User.find(update_user_id) rescue nil
|
User.find(update_user_id) rescue nil
|
||||||
end
|
end
|
||||||
|
@ -42,10 +44,6 @@ class Bulletin
|
||||||
self.update_user_id = user.id
|
self.update_user_id = user.id
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.can_display()
|
|
||||||
self.any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil})
|
|
||||||
end
|
|
||||||
|
|
||||||
def email_members
|
def email_members
|
||||||
MemberProfile.find(self.email_member_ids) rescue []
|
MemberProfile.find(self.email_member_ids) rescue []
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue