From ae0f54c9a89bdf2bb7547d360159fe45834bb411 Mon Sep 17 00:00:00 2001 From: Toks Date: Fri, 29 Mar 2013 12:07:01 -0400 Subject: [PATCH] fixes #587 --- app/logical/post_query_builder.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/logical/post_query_builder.rb b/app/logical/post_query_builder.rb index e46e06f20..8fff27df7 100644 --- a/app/logical/post_query_builder.rb +++ b/app/logical/post_query_builder.rb @@ -235,6 +235,18 @@ class PostQueryBuilder when "favcount_asc" relation = relation.order("posts.fav_count ASC, posts.id DESC") + when "comment" + relation = relation.order("posts.last_commented_at DESC, posts.id DESC").where("posts.last_commented_at is not null") + + when "comment_asc" + relation = relation.order("posts.last_commented_at ASC, posts.id DESC").where("posts.last_commented_at is not null") + + when "note" + relation = relation.order("posts.last_noted_at DESC, posts.id DESC").where("posts.last_noted_at is not null") + + when "note_asc" + relation = relation.order("posts.last_noted_at ASC, posts.id DESC").where("posts.last_noted_at is not null") + when "mpixels", "mpixels_desc" # Use "w*h/1000000", even though "w*h" would give the same result, so this can use # the posts_mpixels index.