Merge pull request #4416 from MaximilianKrambach/categoryHotFix
category sort view hotfix
This commit is contained in:
commit
1ce6804a43
@ -188,10 +188,21 @@ export class CategoryListComponent extends BaseViewComponent implements OnInit {
|
|||||||
* @returns all motions in the category
|
* @returns all motions in the category
|
||||||
*/
|
*/
|
||||||
public motionsInCategory(category: Category): ViewMotion[] {
|
public motionsInCategory(category: Category): ViewMotion[] {
|
||||||
|
const coll = new Intl.Collator(this.translate.currentLang);
|
||||||
return this.motionRepo
|
return this.motionRepo
|
||||||
.getViewModelList()
|
.getViewModelList()
|
||||||
.filter(m => m.category_id === category.id)
|
.filter(m => m.category_id === category.id)
|
||||||
.sort((motion1, motion2) => motion1.identifier.localeCompare(motion2.identifier));
|
.sort((motion1, motion2) => {
|
||||||
|
if (motion1.identifier && motion2.identifier) {
|
||||||
|
return coll.compare(motion1.identifier, motion2.identifier);
|
||||||
|
} else if (motion1.identifier) {
|
||||||
|
return 1;
|
||||||
|
} else if (motion2.identifier) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return coll.compare(motion1.getTitle(), motion2.getTitle());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user