Fix query for date in bulletin

This commit is contained in:
chris 2013-03-06 17:15:47 +08:00
parent 8374bc8d12
commit 9684189258
1 changed files with 2 additions and 2 deletions

View File

@ -36,8 +36,8 @@ class DefaultWidgetController< OrbitWidgetController
else #no tag has cate else #no tag has cate
result = eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id'])") result = eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id'])")
end end
date_now = Time.now
result.available_for_lang(I18n.locale).can_display 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 end
def default_widget def default_widget