Sort motions in categories by inner weight (again)

Fixes sorting categories by inner weight
This commit is contained in:
Sean 2020-04-14 15:01:42 +02:00
parent b7566fcc69
commit 5b7bbfd0bb

View File

@ -98,10 +98,10 @@ export class MotionSortListService extends BaseSortListService<ViewMotion> {
* @returns {number} The result of comparing.
*/
private categorySortFn(itemA: ViewMotion, itemB: ViewMotion, ascending: boolean): number {
if (itemA.category.weight < itemB.category.weight === ascending) {
return -1;
if (itemA.category_id === itemB.category_id) {
return itemA.category_weight < itemB.category_weight === ascending ? -1 : 1;
} else {
return 1;
return itemA.category.weight < itemB.category.weight === ascending ? -1 : 1;
}
}
}