fix not filter categories frontend pages.

This commit is contained in:
BOHUNG 2020-02-24 17:01:11 +08:00
parent d203c115c5
commit 91346e6fe2
1 changed files with 4 additions and 4 deletions

View File

@ -50,10 +50,10 @@ module AnnouncementsHelper
top_anns = [] top_anns = []
tags = page.tags tags = page.tags
if !tags.blank? 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 else
if !params["source"].present? 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") feeds_anns = get_feed_announcements("index")
else else
announcements = [] announcements = []
@ -63,9 +63,9 @@ module AnnouncementsHelper
# (OrbitHelper.page_number == 1 or OrbitHelper.page_number.nil?) && # (OrbitHelper.page_number == 1 or OrbitHelper.page_number.nil?) &&
if !params["source"].present? if !params["source"].present?
if !tags.blank? 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 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
end end