1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

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
This commit is contained in:
Chad Little 2015-08-17 11:48:29 -07:00
parent ee8e436390
commit bd0bbc713a

View file

@ -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()];