Fix sorting algorithm for group-by-project
Summary: When viewing Maniphest tasks grouped by project, there's this weird algorithm that involves generating strings to use as sort keys. It's pretty clearly wrong in several cases; this aims to fix it. Test Plan: Open Maniphest and try to sort by things. Unfortunately, I don't have access to a decent Maniphest database, so I'm not certain it works as it should. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin, mikaaay Maniphest Tasks: T1595 Differential Revision: https://secure.phabricator.com/D3142
This commit is contained in:
@@ -582,20 +582,10 @@ final class ManiphestTaskListController extends ManiphestController {
|
||||
break;
|
||||
case 'project':
|
||||
$grouped = array();
|
||||
foreach ($data as $task) {
|
||||
$phids = $task->getProjectPHIDs();
|
||||
if ($project_phids && $any_project !== true) {
|
||||
// If the user is filtering on "Bugs", don't show a "Bugs" group
|
||||
// with every result since that's silly (the query also does this
|
||||
// on the backend).
|
||||
$phids = array_diff($phids, $project_phids);
|
||||
}
|
||||
if ($phids) {
|
||||
foreach ($phids as $phid) {
|
||||
$grouped[$handles[$phid]->getName()][$task->getID()] = $task;
|
||||
}
|
||||
} else {
|
||||
$grouped['No Project'][$task->getID()] = $task;
|
||||
foreach ($query->getGroupByProjectResults() as $project => $tasks) {
|
||||
foreach ($tasks as $task) {
|
||||
$group = $project ? $handles[$project]->getName() : 'No Project';
|
||||
$grouped[$group][$task->getID()] = $task;
|
||||
}
|
||||
}
|
||||
$data = $grouped;
|
||||
|
||||
Reference in New Issue
Block a user