From e4b17616513a7e21726fd49871521f47f650033d Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 16 Jun 2021 11:05:46 +0800 Subject: [PATCH] try fix error --- app/controllers/admin/event_news_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/event_news_controller.rb b/app/controllers/admin/event_news_controller.rb index afcc399..65dcd18 100644 --- a/app/controllers/admin/event_news_controller.rb +++ b/app/controllers/admin/event_news_controller.rb @@ -22,12 +22,12 @@ class Admin::EventNewsController < OrbitAdminController @categories = current_user.approved_categories.select{|c| c.module_app_id == @module_app.id} rescue [] @filter_fields = filter_fields(@categories, @tags) @event_news = EventNews.where(:category_id.ne=>nil, :create_user_id=>current_user.id,:is_preview.in=>[false,nil]) - .order_by(sort) + .order_by(sort || :event_date) .with_categories(filters("category")) .with_tags(filters("tag")) .with_status(filters("status")) else - @event_news = EventNews.where(:category_id.ne=>nil, :uid=>nil) + @event_news = EventNews.where(:category_id.ne=>nil, :uid=>nil).order_by(sort || :event_date) @categories = @module_app.categories.enabled @filter_fields = filter_fields(@categories, @tags) end @@ -35,7 +35,7 @@ class Admin::EventNewsController < OrbitAdminController @categories = @module_app.categories.enabled @filter_fields = filter_fields(@categories, @tags) @event_news = EventNews.where(:category_id.ne=>nil, :is_preview.in=>[false,nil]) - .order_by(sort) + .order_by(sort || :event_date) .with_categories(filters("category")) .with_tags(filters("tag")) .with_status(filters("status"))