From fe8e6a22814078792acc121bbe6b909ee3e93ffc Mon Sep 17 00:00:00 2001 From: Bohung Date: Mon, 18 Oct 2021 09:41:50 +0800 Subject: [PATCH] Change sort order. --- app/models/event_news.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/event_news.rb b/app/models/event_news.rb index 0cf0962..88419b6 100644 --- a/app/models/event_news.rb +++ b/app/models/event_news.rb @@ -81,7 +81,7 @@ class EventNews before_destroy :destroy_email 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(:is_hidden.ne=>true,:is_preview.ne => true).any_of({:postdate.lte=>Time.now, :deadline.gte=>Time.now},{:postdate.lte=>Time.now, :deadline=>nil},{:postdate=>nil}).order(is_top: :desc,postdate: :desc, event_date: :desc,id: :desc)} + scope :can_display_and_sorted, ->{where(:is_hidden.ne=>true,:is_preview.ne => true).any_of({:postdate.lte=>Time.now, :deadline.gte=>Time.now},{:postdate.lte=>Time.now, :deadline=>nil},{:postdate=>nil}).order(is_top: :desc, event_date: :desc,postdate: :desc,id: :desc)} scope :can_display_and_sorted_according_today, ->{where(:is_hidden.ne=>true,:is_preview.ne => true).any_of({:postdate.lte=>Time.now, :deadline.gte=>Time.now},{:postdate.lte=>Time.now, :deadline=>nil},{:postdate=>nil}).order(is_top: :desc, event_date: :asc,postdate: :desc,id: :desc).where(:event_date.gte => Date.today.to_time)} scope :is_approved, ->{where(:approved => true)} scope :is_approved_and_show, ->{where(:approved => true,:is_hidden.ne=>true,:is_preview.ne => true)}