This commit is contained in:
BoHung Chiu 2021-10-09 22:28:55 +08:00
parent 5b35b816ea
commit 0b3084bcd1
1 changed files with 5 additions and 1 deletions

View File

@ -14,6 +14,10 @@ class AnnouncementsController < ApplicationController
def index def index
Bulletin.remove_expired_status Bulletin.remove_expired_status
sorted,total_pages = get_sorted_annc sorted,total_pages = get_sorted_annc
if sorted.nil?
sorted = []
total_pages = 0
end
anns = sorted.collect do |a| anns = sorted.collect do |a|
if a["source-site"].blank? if a["source-site"].blank?
statuses = a.statuses_with_classname.collect do |status| statuses = a.statuses_with_classname.collect do |status|
@ -461,7 +465,7 @@ class AnnouncementsController < ApplicationController
widget_data_count = OrbitHelper.widget_data_count widget_data_count = OrbitHelper.widget_data_count
anns_cache = AnnsCache.where(parent_id: subpart.id.to_s + cats.to_s + tags.to_s + widget_data_count.to_s,locale: I18n.locale.to_s) anns_cache = AnnsCache.where(parent_id: subpart.id.to_s + cats.to_s + tags.to_s + widget_data_count.to_s,locale: I18n.locale.to_s)
devide_flag = (!(defined? SiteFeed).nil?) devide_flag = (!(defined? SiteFeed).nil?)
anns_cache.where(:invalid_date.lte => Time.now).destroy anns_cache.where(:invalid_date.ne=>nil).where(:invalid_date.lte => Time.now).destroy
count = anns_cache.count count = anns_cache.count
if count > 1 if count > 1
anns_cache.limit(count-1).destroy anns_cache.limit(count-1).destroy