fix for tags

This commit is contained in:
Harry Bomrah 2015-12-16 16:01:09 +08:00
parent 7b0008c03a
commit 5ecd24c977
1 changed files with 2 additions and 2 deletions

View File

@ -101,7 +101,7 @@ class AnnouncementsController < ApplicationController
def random_announcement_widget def random_announcement_widget
uid = OrbitHelper.params[:uid] rescue "" uid = OrbitHelper.params[:uid] rescue ""
tags = ["all"] if OrbitHelper.widget_tags.empty? tags = OrbitHelper.widget_tags
categories = OrbitHelper.widget_categories || [] 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) 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 def widget
uid = OrbitHelper.params[:uid] rescue "" 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) 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) pack_data(announcements)