From 64c4682cc7a29b34e170f7d2049e7ab70548f0ca Mon Sep 17 00:00:00 2001 From: Carl Chenet Date: Tue, 16 May 2017 18:50:50 +0200 Subject: [PATCH] Comment: regardless of confidence, negative thread-leaders go --- app/models/comment.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/comment.rb b/app/models/comment.rb index efc083e..b18d956 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -50,7 +50,8 @@ class Comment < ActiveRecord::Base end def self.arrange_for_user(user) - parents = self.order("confidence DESC").group_by(&:parent_comment_id) + parents = self.order("(upvotes - downvotes) < 0 ASC, confidence DESC"). + group_by(&:parent_comment_id) # top-down list of comments, regardless of indent level ordered = []