Skip to content

Commit

Permalink
Fix numeric sorting (#2823)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsangmeister authored Sep 26, 2023
1 parent e237b39 commit 3800bde
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class MotionSlideComponent

const paragraphNumbers = Object.keys(amendment.amendment_paragraphs)
.map(x => +x)
.sort();
.sort((a, b) => a - b);

return paragraphNumbers
.map(paraNo => {
Expand Down Expand Up @@ -401,7 +401,7 @@ export class MotionSlideComponent

const paragraphNumbers = Object.keys(motion.amendment_paragraphs)
.map(x => +x)
.sort();
.sort((a, b) => a - b);
const amendmentParagraphs: DiffLinesInParagraph[] = paragraphNumbers
.map(paraNo =>
this.diff.getAmendmentParagraphsLines(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export class SortingListComponent<T extends Selectable = Selectable> implements
const newMultiSelectedIndex = multiSelectedIndex
.map(index => this.currentItems.findIndex(item => item.id === this.sortedItems[index].id))
.filter(index => index !== -1)
.sort();
.sort((a, b) => a - b);
let newCurrentIndex = Math.min(event.currentIndex, this.currentItems.length - 1);
if (newPreviousIndex === -1) {
newPreviousIndex = newMultiSelectedIndex.length ? newMultiSelectedIndex[0] : undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export class TreeService {
if (!deleteIds.length) {
return tree;
}
deleteIds = deleteIds.sort();
deleteIds = deleteIds.sort((a, b) => a - b);
tree = tree.sort((a, b) =>
a.position != null && b.position != null ? a.position - b.position : b != null ? -1 : 0
);
Expand Down

0 comments on commit 3800bde

Please sign in to comment.