From e4ab677b1a477848b3e425daaef9c62f649debd2 Mon Sep 17 00:00:00 2001 From: anabellabuckvar <41971124+anabellabuckvar@users.noreply.github.com> Date: Wed, 17 Apr 2024 12:16:50 -0400 Subject: [PATCH] DOP-4549 re fix sorting --- api/handlers/slack.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/api/handlers/slack.ts b/api/handlers/slack.ts index f94165698..0d2efe505 100644 --- a/api/handlers/slack.ts +++ b/api/handlers/slack.ts @@ -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) { @@ -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) {