fix error
This commit is contained in:
parent
09b6b81f5a
commit
b801cd64b7
|
@ -11,17 +11,17 @@ class EventNewsFeed
|
|||
cache.regenerate
|
||||
end
|
||||
end
|
||||
def self.create_feed_cache(bulletin=nil,bulletin_feed=nil)
|
||||
def self.create_feed_cache(event_news=nil,event_news_feed=nil)
|
||||
Thread.new do
|
||||
if !bulletin.nil?
|
||||
self.where(:tag_ids.in => Array(bulletin.tag_ids).collect{|v| v.to_s}).each do |bulletin_feed|
|
||||
uid = bulletin_feed.uid
|
||||
if !event_news.nil?
|
||||
self.where(:tag_ids.in => Array(event_news.tag_ids).collect{|v| v.to_s}).each do |event_news_feed|
|
||||
uid = event_news_feed.uid
|
||||
EventNewsCache.where(:uid => uid).each do |cache|
|
||||
cache.regenerate
|
||||
end
|
||||
end
|
||||
elsif !bulletin_feed.nil?
|
||||
uid = bulletin_feed.uid
|
||||
elsif !event_news_feed.nil?
|
||||
uid = event_news_feed.uid
|
||||
EventNewsCache.where(:uid => uid).each do |cache|
|
||||
cache.regenerate
|
||||
end
|
||||
|
@ -122,8 +122,8 @@ class EventNewsFeed
|
|||
a["author"] = author
|
||||
a["params"] = anns.to_param
|
||||
a["subtitle_ann"] = anns.subtitle if anns.display_subtitle?
|
||||
a["bulletin_links"] = []
|
||||
a["bulletin_files"] = []
|
||||
a["event_news_links"] = []
|
||||
a["event_news_files"] = []
|
||||
a["event_carousel_images"] = anns.event_carousel_images.map{|image| {"src"=>"#{base_url}" + image.file.url,"description"=>image.description.to_s,"description_text"=>image.description_text }}
|
||||
a["external_link"] = anns["is_external_link"] ? anns.external_link : nil
|
||||
anns.tags.each do |tag|
|
||||
|
@ -139,18 +139,18 @@ class EventNewsFeed
|
|||
category_titles << {"title_translations" => cat.title_translations}
|
||||
end
|
||||
a["category"] = {"title_translations" => (cat.title_translations rescue {})}
|
||||
anns.bulletin_links.each do |bl|
|
||||
anns.event_news_links.each do |bl|
|
||||
b = {}
|
||||
b["url"] = bl.url
|
||||
b["title_translations"] = bl.title_translations
|
||||
a["bulletin_links"] << b
|
||||
a["event_news_links"] << b
|
||||
end
|
||||
anns.bulletin_files.each do |bf|
|
||||
anns.event_news_files.each do |bf|
|
||||
b = {}
|
||||
b["description_translations"] = bf.description_translations
|
||||
b["title_translations"] = bf.title_translations
|
||||
b["url"] = ("#{base_url}" + bf.file.url rescue "")
|
||||
a["bulletin_files"] << b
|
||||
a["event_news_files"] << b
|
||||
end
|
||||
all_anns << a
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue