Fix no content in index page problem.

This commit is contained in:
chiu 2020-06-11 17:22:34 +08:00
parent 79e0b5b0ba
commit b344e5ee61
1 changed files with 2 additions and 2 deletions

View File

@ -340,8 +340,8 @@ F cats = files_by_cateogry.keys.collect do |cat|
end
private
def get_sorted_cat_with_filter(categories,cat_type)
all_categories_with_nil = ArchiveCategory.all.in(sort_number: nil).uniq!{|c| c.category_id }.to_a rescue []
all_categories_no_nil = ArchiveCategory.all.not_in(sort_number: nil).order_by(sort_number: 'desc').uniq!{|c| c.category_id }.to_a rescue []
all_categories_with_nil = ArchiveCategory.all.in(sort_number: nil).uniq{|c| c.category_id }.to_a rescue []
all_categories_no_nil = ArchiveCategory.all.not_in(sort_number: nil).order_by(sort_number: 'desc').uniq{|c| c.category_id }.to_a rescue []
all_categories_id = all_categories_no_nil.concat(all_categories_with_nil).collect do |cat|
cat.category_id.to_s
end