From 8490db6992020a8a2a5b177293818b73b30b5408 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 27 Apr 2016 19:28:30 +0800 Subject: [PATCH] small fix --- app/controllers/announcements_controller.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index d0880ec..9d6313f 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -18,11 +18,10 @@ class AnnouncementsController < ApplicationController end end - if !params["source"].present? - if (OrbitHelper.page_number == 1 or OrbitHelper.page_number.nil?) - top_anns = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil], :is_top => true).and(:title.ne => nil).can_display.filter_by_categories([],false).to_a - end + if (OrbitHelper.page_number == 1 or OrbitHelper.page_number.nil?) && !params["source"].present? + top_anns = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil], :is_top => true).and(:title.ne => nil).can_display.filter_by_categories([],false).to_a end + if !feeds_anns.blank? announcements = announcements.concat(feeds_anns) sorted = announcements.sort{ |k,v| v["postdate"] <=> k["postdate"] } @@ -80,7 +79,7 @@ class AnnouncementsController < ApplicationController "view_count" => a.view_count } else - anns << a if a["source-site-title"] == params["source"] + anns << a end end #If no data , hide title&table @@ -111,12 +110,12 @@ class AnnouncementsController < ApplicationController end - def get_feed_announcements(type,source=nil) + def get_feed_announcements(type,site_source=nil) feed_anns = OrbitHelper.get_feed_for_module(type) fans = [] locale = OrbitHelper.get_site_locale.to_s feed_anns.each do |fa| - next if !source.nil? && source != fa["source-site-title"] + next if !site_source.nil? && site_source != fa["source-site-title"] status = { "status" => "#{fa["source-site-title"]}", "status-class" => "status-source"