Fix home banner for hot news

This commit is contained in:
Christophe Vilayphiou 2012-09-21 15:34:18 +08:00
parent b6c06c6d4f
commit 88d562450a
1 changed files with 2 additions and 2 deletions

View File

@ -154,9 +154,9 @@ class NewsBulletin
# any_of({ :title => "test" },{:deadline => nil, :title => "123"})
if category_id.to_s.size > 0
find(:all, :conditions => {news_bulletin_category_id: category_id}).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate)
find(:all, :conditions => {news_bulletin_category_id: category_id}).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).where(is_hot: true).desc(:postdate)
else
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate)
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).where(is_hot: true).desc(:postdate)
end
end