diff --git a/backend/src/database/repositories/memberRepository.ts b/backend/src/database/repositories/memberRepository.ts index 8bb16aae00..da471d8f3b 100644 --- a/backend/src/database/repositories/memberRepository.ts +++ b/backend/src/database/repositories/memberRepository.ts @@ -268,7 +268,7 @@ class MemberRepository { AND ms."segmentId" IN (:segmentIds) ) AS "membersToMerge" ORDER BY - "membersToMerge"."joinedAt" DESC + "membersToMerge"."similarity" DESC LIMIT :limit OFFSET :offset `, { diff --git a/backend/src/services/__tests__/tenantService.test.ts b/backend/src/services/__tests__/tenantService.test.ts index 95155e4d4a..8ac680bbfc 100644 --- a/backend/src/services/__tests__/tenantService.test.ts +++ b/backend/src/services/__tests__/tenantService.test.ts @@ -83,8 +83,8 @@ describe('TenantService tests', () => { const member3 = await memberService.upsert(memberToCreate3) let member4 = await memberService.upsert(memberToCreate4) - await memberService.addToMerge([{ members: [member1.id, member2.id], similarity: null }]) - await memberService.addToMerge([{ members: [member3.id, member4.id], similarity: null }]) + await memberService.addToMerge([{ members: [member1.id, member2.id], similarity: 1 }]) + await memberService.addToMerge([{ members: [member3.id, member4.id], similarity: 0.5 }]) member2 = await memberService.findById(member2.id) member4 = await memberService.findById(member4.id)