From fc14bb8105b8b032f2702a15964bdf608da62712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Wed, 24 Apr 2024 20:59:28 +0800 Subject: [PATCH] Hide no postdate bulletins in frontend. --- app/models/bulletin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/bulletin.rb b/app/models/bulletin.rb index d78ba3c..9004e0f 100644 --- a/app/models/bulletin.rb +++ b/app/models/bulletin.rb @@ -103,7 +103,7 @@ class Bulletin scope :open_in_future, ->{where(:is_hidden.ne=>true,:is_preview.ne => true,:postdate.gt=>Time.now).order(postdate: :asc)} scope :can_display_and_sorted, ->{where(:approved => true,:is_hidden.ne=>true,:is_preview.ne => true).valid_time_range} - scope :valid_time_range, ->{and_any_of([{"postdate"=>{"$lte"=> Time.now}, "deadline"=>{"$gte"=> Time.now}}, {"postdate"=>{"$lte"=> Time.now}, "deadline"=>nil}, {"postdate"=>nil, "deadline"=>{"$gte"=>Time.now}}, {"postdate"=>nil, "deadline"=>nil}]).order((@manually_sort ? {is_top: :desc,sort_number: :asc,postdate: :desc,id: :desc} : {is_top: :desc,postdate: :desc,id: :desc}))} + scope :valid_time_range, ->{and_any_of([{"postdate"=>{"$lte"=> Time.now}, "deadline"=>{"$gte"=> Time.now}}, {"postdate"=>{"$lte"=> Time.now}, "deadline"=>nil}]).order((@manually_sort ? {is_top: :desc,sort_number: :asc,postdate: :desc,id: :desc} : {is_top: :desc,postdate: :desc,id: :desc}))} scope :is_approved, ->{where(:approved => true)} scope :is_approved_and_show, ->{where(:approved => true,:is_hidden.ne=>true,:is_preview.ne => true)} scope :filter_cats_and_tags, ->(cats,tags) {filter_by_widget_categories(cats,false).filter_by_tags(tags)}