From b55988af3308063c581d97e3997ae8b0c6eaea30 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 6 Mar 2013 17:57:16 +0800 Subject: [PATCH] Fix query for top in bulletin --- app/controllers/default_widget_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/default_widget_controller.rb b/app/controllers/default_widget_controller.rb index dd9df0ee..d6717f76 100644 --- a/app/controllers/default_widget_controller.rb +++ b/app/controllers/default_widget_controller.rb @@ -37,7 +37,7 @@ class DefaultWidgetController< OrbitWidgetController result = eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id'])") end date_now = Time.now - result.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:created_at) + result.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, :created_at) end def default_widget