Merge pull request #5310 from tsiegleauq/better-category-sorting

Sort motions in categories by inner weight (again)
This commit is contained in:
Emanuel Schütze 2020-04-15 09:25:19 +02:00 committed by GitHub
commit a7518ed5b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;
}
}
}