fix error

This commit is contained in:
邱博亞 2022-03-30 15:41:51 +08:00
parent 79476c545b
commit dd05a8fc53
2 changed files with 5 additions and 1 deletions

View File

@ -195,7 +195,6 @@ module AnnouncementsHelper
.can_display_and_sorted.is_approved
.filter_by_categories(categories,false).filter_by_tags(tags).to_a
end
print('announcements',announcements.collect(&:title))
if !(defined? SiteFeed).nil?
if @type != "show_widget"
feeds_anns = get_feed_announcements("index",nil,categories,page_number*page_data_count)

View File

@ -106,6 +106,11 @@ class Bulletin
scope :filter_cats_and_tags, ->(cats,tags) {filter_by_widget_categories(cats,false).filter_by_tags(tags)}
before_create :set_expire
before_save :check_limit
before_save do
if self.is_top_changed? && !self.is_top
self.sort_number = nil
end
end
index({postdate: 1}, { unique: false, background: true })
index({is_top: -1,postdate: -1, _id: -1}, { unique: false, background: true })
index({approved: -1,is_hidden: 1,is_preview: 1, is_top: -1,postdate: -1,_id: -1,deadline: -1}, { unique: false, background: true })