fix some error

This commit is contained in:
chiu 2020-03-24 23:01:49 +08:00
parent eb50bc6b49
commit b2089c26ca
1 changed files with 10 additions and 10 deletions

View File

@ -78,7 +78,7 @@ class EPapersController < ApplicationController
end
data = []
papers.each do |category, topics|
topics_data = topics.collect do |topic|
topics_data = Array(topics).compact.collect do |topic|
{
"title" => topic.title,
"link_to_show" => OrbitHelper.url_to_show(topic.to_param),
@ -117,7 +117,7 @@ class EPapersController < ApplicationController
def criteria_list
params = OrbitHelper.params
criterias = PaperCriteria.all.desc(:start_date).limit(OrbitHelper.widget_data_count)
data = criterias.collect do |criteria|
data = Array(criterias).compact.collect do |criteria|
{
"title" => criteria.title,
"description" => criteria.description,
@ -136,14 +136,14 @@ class EPapersController < ApplicationController
def category_wise_articles
topics = EPaperTopic.filter_by_widget_categories.desc(:period)
data = topics.collect do |topic|
data = Array(topics).compact.collect do |topic|
{
"title" => topic.title,
"link_to_show" => OrbitHelper.widget_item_url(topic.to_param),
"description" => topic.description,
"img_url" => topic.image.url,
"img_url_thumb" => topic.image.thumb.url,
"category" => topic.category.title,
"category" => (topic.category.title rescue nil),
"link_to_show_wise" => OrbitHelper.widget_more_url + "/" + topic.to_param
}
end
@ -160,18 +160,18 @@ class EPapersController < ApplicationController
papers = criteria.epaper_topics.group_by(&:category)
data = []
papers.each do |category, topics|
topics_data = topics.collect do |topic|
topics_data = Array(topics).compact.collect do |topic|
{
"title" => topic.title,
"link_to_show" => OrbitHelper.widget_item_url(topic.to_param),
"description" => topic.description,
"img_url" => topic.image.url,
"img_url_thumb" => topic.image.thumb.url,
"category" => category.title
"category" => (category.title rescue nil)
}
end
data << {
"category_title" => category.title,
"category_title" => (category.title rescue nil),
"topics" => topics_data
}
end
@ -188,18 +188,18 @@ class EPapersController < ApplicationController
papers = criteria.epaper_topics.group_by(&:category)
data = []
papers.each do |category, topics|
topics_data = topics.collect do |topic|
topics_data = Array(topics).compact.collect do |topic|
{
"title" => topic.title,
"link_to_show" => OrbitHelper.widget_item_url(topic.to_param),
"description" => topic.description,
"img_url" => topic.image.url,
"img_url_thumb" => topic.image.thumb.url,
"category" => category.title
"category" => (category.title rescue nil)
}
end
data << {
"category_title" => category.title,
"category_title" => (category.title rescue nil),
"topics" => topics_data
}
end