Ensure if you're sorting by last dueted with date, solo performances are always at the end
Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
This commit is contained in:
parent
56a80d8936
commit
4c33360649
|
@ -15,7 +15,10 @@ const headCells = [
|
||||||
{ id: 'displayLastDuetDate', numeric: false, disablePadding: false, label: 'Last Dueted with Singer' },
|
{ id: 'displayLastDuetDate', numeric: false, disablePadding: false, label: 'Last Dueted with Singer' },
|
||||||
];
|
];
|
||||||
|
|
||||||
function descendingComparator(a, b, orderBy) {
|
function descendingComparator(a, b, orderBy, order) {
|
||||||
|
if ((b[orderBy] === "Solo performance") && (a[orderBy] !== "Solo performance")) {
|
||||||
|
return order === 'desc' ? -1 : 1
|
||||||
|
}
|
||||||
if (orderBy === "displayPublishDate") {
|
if (orderBy === "displayPublishDate") {
|
||||||
orderBy = "publishDate"
|
orderBy = "publishDate"
|
||||||
}
|
}
|
||||||
|
@ -46,8 +49,8 @@ function stableSort(array, comparator) {
|
||||||
|
|
||||||
function getComparator(order, orderBy) {
|
function getComparator(order, orderBy) {
|
||||||
return order === 'desc'
|
return order === 'desc'
|
||||||
? (a, b) => descendingComparator(a, b, orderBy)
|
? (a, b) => descendingComparator(a, b, orderBy, order)
|
||||||
: (a, b) => -descendingComparator(a, b, orderBy);
|
: (a, b) => -descendingComparator(a, b, orderBy, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
function EnhancedTableHead(props) {
|
function EnhancedTableHead(props) {
|
||||||
|
|
Loading…
Reference in New Issue