case 'milestone_id':
$this->orderBy("
+ case
+ when join_status_id.display_name = 'in progress' then 1
+ when join_status_id.display_name = 'resolved' then -1
+ else 0
+ end DESC,
(case when join_milestone_id_id.duedate is null then 1 else 0 end) ASC,
join_milestone_id_id.duedate $direction ,
{$tn}.seqid $direction ,
');
return;
case 'priority_id':
- $this->orderBy(" join_priority_id_id.seqid $direction, {$tn}.seqid ASC ");
+ $this->orderBy("
+ case
+ when join_status_id.display_name = 'in progress' then 1
+ when join_status_id.display_name = 'resolved' then -1
+ else 0
+ end DESC,
+ join_priority_id_id.seqid $direction, {$tn}.seqid ASC
+ ");
break;
default:
// this should favour in_progress, and disfavour resolved