fix error

This commit is contained in:
chiu 2023-09-13 15:32:43 +00:00
parent 0754bfad3e
commit 53c07e53fe
1 changed files with 1 additions and 1 deletions

View File

@ -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 :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 :can_display_and_sorted, ->{where(:approved => true,:is_hidden.ne=>true,:is_preview.ne => true).valid_time_range}
scope :valid_time_range, ->{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},{: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 :is_approved, ->{where(:approved => true)} scope :is_approved, ->{where(:approved => true)}
scope :is_approved_and_show, ->{where(:approved => true,:is_hidden.ne=>true,:is_preview.ne => 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)} scope :filter_cats_and_tags, ->(cats,tags) {filter_by_widget_categories(cats,false).filter_by_tags(tags)}