From 91346e6fe2116ad89989c7e88b242cab8742afc7 Mon Sep 17 00:00:00 2001 From: BOHUNG Date: Mon, 24 Feb 2020 17:01:11 +0800 Subject: [PATCH] fix not filter categories frontend pages. --- app/helpers/announcements_helper.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers/announcements_helper.rb b/app/helpers/announcements_helper.rb index 0197a37..73dd55f 100644 --- a/app/helpers/announcements_helper.rb +++ b/app/helpers/announcements_helper.rb @@ -50,10 +50,10 @@ module AnnouncementsHelper top_anns = [] tags = page.tags if !tags.blank? - announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).and(:title.ne => nil).can_display.is_approved.filter_by_tags(tags).page(OrbitHelper.page_number).per(OrbitHelper.page_data_count).to_a + announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).and(:title.ne => nil).can_display.is_approved.filter_by_categories(page.categories || [],false).filter_by_tags(tags).page(OrbitHelper.page_number).per(OrbitHelper.page_data_count).to_a else if !params["source"].present? - announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).and(:title.ne => nil, :is_top.ne => true).can_display.is_approved.filter_by_categories([],false).filter_by_tags.to_a + announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).and(:title.ne => nil, :is_top.ne => true).can_display.is_approved.filter_by_categories(page.categories || [],false).filter_by_tags.to_a feeds_anns = get_feed_announcements("index") else announcements = [] @@ -63,9 +63,9 @@ module AnnouncementsHelper # (OrbitHelper.page_number == 1 or OrbitHelper.page_number.nil?) && if !params["source"].present? if !tags.blank? - top_anns = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil], :is_top => true).and(:title.ne => nil).can_display.filter_by_categories([],false).filter_by_tags(tags).to_a + top_anns = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil], :is_top => true).and(:title.ne => nil).can_display.filter_by_categories(page.categories || [],false).filter_by_tags(tags).to_a else - top_anns = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil], :is_top => true).and(:title.ne => nil).can_display.filter_by_categories([],false).filter_by_tags.to_a + top_anns = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil], :is_top => true).and(:title.ne => nil).can_display.filter_by_categories(page.categories || [],false).filter_by_tags.to_a end end