Skip to content

Commit

Permalink
Bug: 14403 Take recurring tasks into account when sorting.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Aug 4, 2016
1 parent 8d2c210 commit 413cd0c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions nag/lib/Nag.php
Expand Up @@ -1565,19 +1565,26 @@ public static function _rsortByEstimate($a, $b)
*/
public static function _sortByDue($a, $b)
{
if ($a->due == $b->due) {
$a_due = empty($a->due)
? 0
: $a->getNextDue()->timestamp();
$b_due = empty($b->due)
? 0
: $b->getNextDue()->timestamp();

if ($a_due == $b_due) {
return self::_sortByName($a, $b);
}

// Treat empty due dates as farthest into the future.
if ($a->due == 0) {
if ($a_due == 0) {
return 1;
}
if ($b->due == 0) {
if ($b_due == 0) {
return -1;
}

return ($a->due > $b->due) ? 1 : -1;
return ($a_due > $b_due) ? 1 : -1;
}

/**
Expand Down

0 comments on commit 413cd0c

Please sign in to comment.