From 6df7981ad18916b69ef91a56ae5d99c6b82faf31 Mon Sep 17 00:00:00 2001 From: nccu Date: Mon, 29 Dec 2014 17:18:06 +0800 Subject: [PATCH] fix announcement deadline --- app/controllers/announcements_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 3835a9c..26c190c 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -7,25 +7,25 @@ class AnnouncementsController < ApplicationController if params[:keywords] !params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"} - announcements = Bulletin.where(:title.ne => "").any_of(:title => /#{params[:keywords].to_s}/i).is_approved.order_by(sort).filter_by_categories(["all"]).per(15) if !params[:keywords].nil? + announcements = Bulletin.where(:title.ne => "").any_of(:title => /#{params[:keywords].to_s}/i).can_display.is_approved.order_by(sort).filter_by_categories(["all"]).per(15) if !params[:keywords].nil? announcements_count = announcements.count keyword = params[:keywords] elsif params[:unit] !params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"} - announcements = Bulletin.where(:title.ne => "" ,:cache_dept => params[:unit].to_s).is_approved.order_by(sort).filter_by_categories(["all"]).per(15) if !params[:unit].nil? + announcements = Bulletin.where(:title.ne => "" ,:cache_dept => params[:unit].to_s).can_display.is_approved.order_by(sort).filter_by_categories(["all"]).per(15) if !params[:unit].nil? announcements_count = announcements.count keyword = params[:unit] elsif params[:tag] !params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"} - announcements = Bulletin.where(:title.ne => "" ,:is_preview.in=>[false,nil]).is_approved.order_by(sort).filter_by_categories(["all"]).filter_by_tags([params[:tag]]) + announcements = Bulletin.where(:title.ne => "" ,:is_preview.in=>[false,nil]).can_display.is_approved.order_by(sort).filter_by_categories(["all"]).filter_by_tags([params[:tag]]) else sort = ( !params[:sort].blank? ? {params[:sort].to_sym=>params[:order]} : {:postdate=>"desc"}) # announcements = Bulletin.where(:title.ne => "" ,:is_preview.in=>[false,nil]).can_display.is_approved.order_by(sort).filter_by_categories.filter_by_tags(OrbitHelper.page_tags) if OrbitHelper.page_categories.first == "all" - announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).is_approved.order_by(sort).filter_by_tags.page(params[:page_no]).per(OrbitHelper.page_data_count) + announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).can_display.is_approved.order_by(sort).filter_by_tags.page(params[:page_no]).per(OrbitHelper.page_data_count) else - announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).is_approved.filter_by_categories.filter_by_tags.can_display.order_by(sort).page(params[:page_no]).per(OrbitHelper.page_data_count) + announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).can_display.is_approved.filter_by_categories.filter_by_tags.can_display.order_by(sort).page(params[:page_no]).per(OrbitHelper.page_data_count) end end page = Page.where(:module => "announcement").first rescue nil