Update archives_controller.rb

This commit is contained in:
chiu 2019-09-20 14:17:26 +08:00
parent 06fa9989fc
commit a9666ff3f8
1 changed files with 6 additions and 7 deletions

View File

@ -262,7 +262,7 @@ F cats = files_by_cateogry.keys.collect do |cat|
if categories.first == "all"
categories = OrbitHelper.widget_module_app.categories
puts categories
categories_sort = get_sorted_cat_with_filter(categories,'orm')
categories_sort = get_sorted_cat_with_filter(categories,'id')
@categories = categories_sort.collect do |cat|
{
"title" => cat.title,
@ -332,14 +332,13 @@ F cats = files_by_cateogry.keys.collect do |cat|
all_categories_id = all_categories_no_nil.concat(all_categories_with_nil).collect do |cat|
cat.category_id.to_s
end
all_categories_id
if cat_type=='id'
categories_temp = ModuleApp.where(:key => "archive").first.categories
categories = categories_temp.where(id: categories)
end
categories_sort = []
all_categories_id.each do |cat_id|
if cat_type=='orm'
category_selected = categories.select{|category| cat_id == category.id.to_s}
elsif cat_type=='id'
category_selected = categories.select{|category| cat_id == category}
end
if category_selected.length!=0
categories_sort << category_selected[0]
end