fix error

This commit is contained in:
邱博亞 2021-11-07 11:37:40 +08:00
parent 3baa783c44
commit 9211ab2cf7
2 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ class AnnouncementFeedsController < ApplicationController
enddt = params[:end].blank? ? nil : params[:end] enddt = params[:end].blank? ? nil : params[:end]
dt = params[:date].blank? ? nil : params[:date] dt = params[:date].blank? ? nil : params[:date]
feed_cache = BulletinFeedCache.where(uid: uid, start: startdt, end: enddt, date: dt) feed_cache = BulletinFeedCache.where(uid: uid, start: startdt, end: enddt, date: dt)
feed_cache.where(:invalid_date.lte => Time.now).destroy feed_cache.all_of({:invalid_date.ne=>nil,:invalid_date.lte => Time.now}).destroy
count = feed_cache.count count = feed_cache.count
if count > 1 if count > 1
feed_cache.limit(count-1).destroy feed_cache.limit(count-1).destroy

View File

@ -465,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.ne=>nil).where(:invalid_date.lte => Time.now).destroy anns_cache.all_of({:invalid_date.ne=>nil,: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