Add created_time as tie breaker when sorting by status in task table (#7460)

* Add created_time as tie breaker when sorting by status

* Fixed bug

* Fixed created_time tie breaker

* Use locale compare
This commit is contained in:
Qi Shu 2019-04-17 23:11:45 -07:00 committed by Clint Wylie
parent c8bffd9351
commit f06f0c3ad8
1 changed files with 3 additions and 3 deletions

View File

@ -493,7 +493,7 @@ ORDER BY "rank" DESC, "created_time" DESC`);
Header: 'Status', Header: 'Status',
id: 'status', id: 'status',
width: 110, width: 110,
accessor: 'status', accessor: (row) => { return {status: row.status, created_time: row.created_time}; },
Cell: row => { Cell: row => {
if (row.aggregated) return ''; if (row.aggregated) return '';
const { status, location } = row.original; const { status, location } = row.original;
@ -521,9 +521,9 @@ ORDER BY "rank" DESC, "created_time" DESC`);
const previewCount = countBy(previewValues); const previewCount = countBy(previewValues);
return <span>{Object.keys(previewCount).sort().map(v => `${v} (${previewCount[v]})`).join(', ')}</span>; return <span>{Object.keys(previewCount).sort().map(v => `${v} (${previewCount[v]})`).join(', ')}</span>;
}, },
sortMethod: (status1: string, status2: string) => { sortMethod: (d1, d2) => {
const statusRanking: any = this.statusRanking; const statusRanking: any = this.statusRanking;
return statusRanking[status1] - statusRanking[status2]; return statusRanking[d1.status] - statusRanking[d2.status] || d1.created_time.localeCompare(d2.created_time);
}, },
show: taskTableColumnSelectionHandler.showColumn('Status') show: taskTableColumnSelectionHandler.showColumn('Status')
}, },