Merge pull request #4733 from tsiegleauq/default-sorting

Fixes an issue where sorting was tried with undefined valued
This commit is contained in:
Emanuel Schütze 2019-05-22 22:59:28 +02:00 committed by GitHub
commit df6dd6a1dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,15 @@ export class ItemRepositoryService extends BaseRepository<ViewItem, Item> {
MotionBlock MotionBlock
]); ]);
this.setSortFunction((a, b) => a.weight - b.weight); this.setSortFunction((a, b) => {
// TODO: In some occasions weight will be undefined, if the user has not the correct set of permission.
// That should not be the case here.
if (a.weight && b.weight) {
return a.weight - b.weight;
} else {
return -1;
}
});
} }
public getVerboseName = (plural: boolean = false) => { public getVerboseName = (plural: boolean = false) => {