Hot or top for news home banner

This commit is contained in:
Christophe Vilayphiou 2012-09-24 08:43:10 +08:00
parent 88d562450a
commit a04e1fd10b
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} ).where(is_hot: true).desc(: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} ).any_of(is_hot: true, is_top: true).desc(:postdate)
else
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).where(is_hot: true).desc(:postdate)
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).any_of(is_hot: true, is_top: true).desc(:postdate)
end
end