Fix category ordering on categories page. I broke it.

This commit is contained in:
Neil Lalonde 2013-12-12 17:13:08 -05:00
parent b41ee7256e
commit 50bd05663c
1 changed files with 9 additions and 8 deletions

View File

@ -56,16 +56,17 @@ class CategoryList
@categories = Category
.includes(:featured_users)
.secured(@guardian)
.order('position ASC')
if latest_post_only?
@categories = @categories
.includes(:latest_post => {:topic => :last_poster} )
.order('position ASC')
else
@categories = @categories
.order('COALESCE(categories.topics_week, 0) DESC')
.order('COALESCE(categories.topics_month, 0) DESC')
.order('COALESCE(categories.topics_year, 0) DESC')
@categories = @categories.includes(:latest_post => {:topic => :last_poster} )
# else
# # This is only for the old 2-column layout.
# # Use this when we support "organic" positioning of some/all categories.
# @categories = @categories
# .order('COALESCE(categories.topics_week, 0) DESC')
# .order('COALESCE(categories.topics_month, 0) DESC')
# .order('COALESCE(categories.topics_year, 0) DESC')
end
@categories = @categories.to_a