From bd0bbc713a36ab132ed2e15525ccfb3eb08b4614 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 17 Aug 2015 11:48:29 -0700 Subject: [PATCH] Sort Ponder Answers by voteCount Summary: Fixes T9207. I think this is correct? Sorts based on vote count and reverses the order of the array so higher is first. Test Plan: Test vote ordering on a number of sample tasks. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T9207 Differential Revision: https://secure.phabricator.com/D13924 --- .../ponder/controller/PonderQuestionViewController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/applications/ponder/controller/PonderQuestionViewController.php b/src/applications/ponder/controller/PonderQuestionViewController.php index 94830f176d..785ad2e709 100644 --- a/src/applications/ponder/controller/PonderQuestionViewController.php +++ b/src/applications/ponder/controller/PonderQuestionViewController.php @@ -225,9 +225,10 @@ final class PonderQuestionViewController extends PonderController { $xaction_groups = mgroup($xactions, 'getObjectPHID'); $author_phids = mpull($answers, 'getAuthorPHID'); $handles = $this->loadViewerHandles($author_phids); + $answers_sort = array_reverse(msort($answers, 'getVoteCount')); $view = array(); - foreach ($answers as $answer) { + foreach ($answers_sort as $answer) { $xactions = idx($xaction_groups, $answer->getPHID(), array()); $id = $answer->getID(); $handle = $handles[$answer->getAuthorPHID()];