Skip to content

Commit

Permalink
DOP-4356 retrying sort accurately
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellabuckvar committed Feb 8, 2024
1 parent 88f205b commit ad6bd4f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/services/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@ export class SlackConnector implements ISlackConnector {
// THis is the limitation enforced by slack as no more 100 items are allowd in the dropdown
//'[ERROR] no more than 100 items allowed [json-pointer:/view/blocks/0/element/options]'

reposToShow
.sort((a, b) =>
a.text
.toString()
.replace(/\d+/g, (n) => +n + 1000)
.localeCompare(b.text.toString().replace(/\d+/g, (n) => +n + 1000))
)
.reverse();
reposToShow.sort((a, b) => {
return b.value
.toString()
.replace(/\d+/g, (n) => +n + 100000)
.localeCompare(a.value.toString().replace(/\d+/g, (n) => +n + 100000));
});

console.log('hello', reposToShow);

if (reposToShow.length > 100) {
reposToShow = reposToShow.splice(0, 100);
Expand Down
1 change: 1 addition & 0 deletions tests/unit/api/slack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jest.mock('../../../src/repositories/docsetsRepository', () => ({
jest.mock('config');

describe('Slack API Controller Tests', () => {
console.log('hello');
const mockEntitlement = {
email: '[email protected]',
github_username: 'test.user',
Expand Down

0 comments on commit ad6bd4f

Please sign in to comment.