From c939216c6d73dcda327b132ac4093d3499516c41 Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 8 Apr 2020 20:55:16 +0800 Subject: [PATCH] fix feed annc error --- app/helpers/announcements_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/announcements_helper.rb b/app/helpers/announcements_helper.rb index 293b118..0c934fa 100644 --- a/app/helpers/announcements_helper.rb +++ b/app/helpers/announcements_helper.rb @@ -63,7 +63,7 @@ module AnnouncementsHelper def get_feed_annc(type,site_source,locale) ma_key = 'announcement' if type == "index" - categories = Array(OrbitHelper.widget_categories) + categories = Array(OrbitHelper.page_categories) elsif type == "widget" categories = Array(OrbitHelper.widget_categories) else @@ -169,7 +169,7 @@ module AnnouncementsHelper rest_anns = rest_all_anns.sort{|v1,v2| v2["postdate"]<=>v1["postdate"]} all_sorted = top_anns.sort{|v1,v2| v2["postdate"]<=>v1["postdate"]} + rest_anns else - all_sorted = feeds_anns.sort{|v1,v2| [v2['is_top'],v2["postdate"]]<=>[v1['is_top'],v1["postdate"]]} + all_sorted = feeds_anns.select{|v| v['is_top']}.sort{|v1,v2| v2["postdate"]<=>v1["postdate"]} + feeds_anns.select{|v| v['is_top'] != true}.sort{|v1,v2| v2["postdate"]<=>v1["postdate"]} end all_filter = filter_by_keywords(all_sorted,params[:keywords]) else