fix error
This commit is contained in:
parent
d6593427f3
commit
c395d4c44d
|
@ -7,6 +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_old = feed_cache.all_of([{:invalid_date.ne=>nil},{:invalid_date.lte => Time.now}]).last
|
||||||
feed_cache.all_of([{:invalid_date.ne=>nil},{: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
|
||||||
|
@ -16,6 +17,7 @@ class AnnouncementFeedsController < ApplicationController
|
||||||
anns = ''
|
anns = ''
|
||||||
if feed_cache.nil?
|
if feed_cache.nil?
|
||||||
anns = BulletinFeed.where(uid: uid).first.generate_one_cache_timeout(startdt: startdt,enddt: enddt,dt: dt,base_url: request.base_url,timeout: 20)
|
anns = BulletinFeed.where(uid: uid).first.generate_one_cache_timeout(startdt: startdt,enddt: enddt,dt: dt,base_url: request.base_url,timeout: 20)
|
||||||
|
anns = (feed_cache_old.content rescue "") if anns.nil?
|
||||||
else
|
else
|
||||||
anns = feed_cache.content
|
anns = feed_cache.content
|
||||||
end
|
end
|
||||||
|
|
|
@ -47,7 +47,7 @@ class BulletinFeed
|
||||||
end
|
end
|
||||||
rescue=> e
|
rescue=> e
|
||||||
puts [e,e.backtrace]
|
puts [e,e.backtrace]
|
||||||
""
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def generate_one_cache(startdt: nil,enddt: nil,dt: nil, base_url: nil)
|
def generate_one_cache(startdt: nil,enddt: nil,dt: nil, base_url: nil)
|
||||||
|
|
Loading…
Reference in New Issue