fix error

This commit is contained in:
邱博亞 2022-02-23 15:05:33 +08:00
parent 35a850b038
commit 2ae8f9abc6
1 changed files with 8 additions and 1 deletions

View File

@ -188,7 +188,14 @@ class BulletinFeed
}.to_json }.to_json
BulletinFeedCache.where(uid: uid,start: startdt,end: enddt,date: dt).destroy BulletinFeedCache.where(uid: uid,start: startdt,end: enddt,date: dt).destroy
feed_cache = BulletinFeedCache.create(uid: uid,content: anns,start: startdt,end: enddt,date: dt,invalid_date: invalid_date) feed_cache = BulletinFeedCache.create(uid: uid,content: anns,start: startdt,end: enddt,date: dt,invalid_date: invalid_date)
feed_cache.content (1..5).each do
if JSON.load(feed_cache.content)['announcements'].length == all_anns.length
break
else
sleep(1)
end
end
all_anns
end end
def self.smart_convertor(text,url) def self.smart_convertor(text,url)
doc = Nokogiri.HTML(text) doc = Nokogiri.HTML(text)