From 5ecd24c977d6cd3b4b7494748b8a4c9104de057e Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 16 Dec 2015 16:01:09 +0800 Subject: [PATCH] fix for tags --- app/controllers/announcements_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 2d96822..64fb224 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -101,7 +101,7 @@ class AnnouncementsController < ApplicationController def random_announcement_widget uid = OrbitHelper.params[:uid] rescue "" - tags = ["all"] if OrbitHelper.widget_tags.empty? + tags = OrbitHelper.widget_tags categories = OrbitHelper.widget_categories || [] announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil],:uid.ne => uid, :category_id.in => categories).and(:title.ne => nil).can_display.is_approved.filter_by_tags(tags).sample(OrbitHelper.widget_data_count) @@ -110,7 +110,7 @@ class AnnouncementsController < ApplicationController def widget uid = OrbitHelper.params[:uid] rescue "" - tags = ["all"] if OrbitHelper.widget_tags.empty? + tags = OrbitHelper.widget_tags announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil],:uid.ne => uid).and(:title.ne => nil).can_display.is_approved.filter_by_widget_categories.filter_by_tags(tags) pack_data(announcements)