From 5b7bbfd0bb39743f776db22cc47d36518c99e692 Mon Sep 17 00:00:00 2001 From: Sean Date: Tue, 14 Apr 2020 15:01:42 +0200 Subject: [PATCH] Sort motions in categories by inner weight (again) Fixes sorting categories by inner weight --- .../app/site/motions/services/motion-sort-list.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/app/site/motions/services/motion-sort-list.service.ts b/client/src/app/site/motions/services/motion-sort-list.service.ts index bf79798ed..b79a9fb00 100644 --- a/client/src/app/site/motions/services/motion-sort-list.service.ts +++ b/client/src/app/site/motions/services/motion-sort-list.service.ts @@ -98,10 +98,10 @@ export class MotionSortListService extends BaseSortListService { * @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; } } }