Skip to content

Commit

Permalink
DOP-4549 re fix sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellabuckvar committed Apr 17, 2024
1 parent 061e849 commit e4ab677
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions api/handlers/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function buildEntitledGroupsList(entitlement: any, repoBranchesRepo
const buildWithSnooty = branch['buildsWithSnooty'];
if (buildWithSnooty) {
const active = branch['active'];
const branchName = `${directoryPath ? '/' + directoryPath : ''}/${branch['gitBranchName']}`;
const branchName = `${directoryPath ? `${directoryPath}/` : ''}${branch['gitBranchName']}`;
const repoPath = `${repoOwner}/${repoName}/${branchName}`;
let txt: string;
if (!active) {
Expand All @@ -78,12 +78,17 @@ export async function buildEntitledGroupsList(entitlement: any, repoBranchesRepo
text: repoName,
},
options: options.sort((branchOne, branchTwo) => {
return branchOne.text.text.localeCompare(branchTwo.text.text);
return branchTwo.text.text
.toString()
.replace(/\d+/g, (n) => +n + 100000)
.localeCompare(branchOne.text.text.toString().replace(/\d+/g, (n) => +n + 100000));
}),
};
repoOptions.push(repoOption);
}
return repoOptions;
return repoOptions.sort((repoOne, repoTwo) => {
return repoOne.label.value.localeCompare(repoTwo.label.value);
});
}

export function getQSString(qs: string) {
Expand Down

0 comments on commit e4ab677

Please sign in to comment.