fix error

This commit is contained in:
邱博亞 2022-02-23 15:53:30 +08:00
parent 2ae8f9abc6
commit ea1a20da41
1 changed files with 3 additions and 8 deletions

View File

@ -80,11 +80,13 @@ class BulletinFeed
anns_before_filter = anns_before_filter.filter_by_tags(tags)
end
if !categories.empty?
anns_before_filter = anns_before_filter.filter_by_categories(categories)
anns_before_filter = anns_before_filter.filter_by_categories(categories,paginate=false)
end
anns_before_filter.selector = {"$and"=>[anns_before_filter.selector,{"$or"=>(I18n.available_locales.map{|v| {"title.#{v}"=>{"$nin"=>["", nil]}}})}]}
if can_display_and_sorted_flag
announcements = anns_before_filter.valid_time_range.to_a
else
announcements = anns_before_filter.to_a
end
else
announcements = []
@ -188,13 +190,6 @@ class BulletinFeed
}.to_json
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)
(1..5).each do
if JSON.load(feed_cache.content)['announcements'].length == all_anns.length
break
else
sleep(1)
end
end
all_anns
end
def self.smart_convertor(text,url)