Ensure if you're sorting by last dueted with date, solo performances are always at the end
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
This commit is contained in:
Martyn 2020-08-01 12:57:02 +02:00
parent 56a80d8936
commit 4c33360649
1 changed files with 6 additions and 3 deletions

View File

@ -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) {