From 9684189258a9a1c4e88184da8d469ae58ebe8fe4 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 6 Mar 2013 17:15:47 +0800 Subject: [PATCH] Fix query for date in bulletin --- app/controllers/default_widget_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/default_widget_controller.rb b/app/controllers/default_widget_controller.rb index eb034bd3..dd9df0ee 100644 --- a/app/controllers/default_widget_controller.rb +++ b/app/controllers/default_widget_controller.rb @@ -36,8 +36,8 @@ class DefaultWidgetController< OrbitWidgetController else #no tag has cate result = eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id'])") end - - result.available_for_lang(I18n.locale).can_display + 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) end def default_widget