From f20aa5cccd2e31d3c6709948a3672ec080b8363f Mon Sep 17 00:00:00 2001 From: capJavert Date: Thu, 22 Jan 2026 19:43:53 +0100 Subject: [PATCH 1/3] fix: application rank is 0-10 --- __tests__/workers/newNotificationV2Mail.ts | 53 +++++++++++++++++++++- src/workers/newNotificationV2Mail.ts | 4 +- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/__tests__/workers/newNotificationV2Mail.ts b/__tests__/workers/newNotificationV2Mail.ts index 863495d442..0345755da8 100644 --- a/__tests__/workers/newNotificationV2Mail.ts +++ b/__tests__/workers/newNotificationV2Mail.ts @@ -2823,7 +2823,7 @@ describe('recruiter_new_candidate notification', () => { opportunityId: opportunitiesFixture[0].id, userId: candidate!.id, applicationRank: { - score: 85, + score: 8, description: 'Strong JS skills', }, }); @@ -2855,7 +2855,56 @@ describe('recruiter_new_candidate notification', () => { candidate_name: 'Ido', profile_picture: 'https://daily.dev/ido.jpg', job_title: 'Senior Full Stack Developer', - score: '85%', + score: '8/10', + matching_content: 'Strong JS skills', + candidate_link: `http://localhost:5002/recruiter/${opportunitiesFixture[0].id}/matches`, + }); + }); + + it('should show N/A label when no application score', async () => { + await saveFixtures(con, DatasetLocation, datasetLocationsFixture); + await saveFixtures(con, Organization, organizationsFixture); + await saveFixtures(con, Opportunity, opportunitiesFixture); + + const candidate = await con.getRepository(User).findOneBy({ id: '1' }); + + // Create match with application rank score + await con.getRepository(OpportunityMatch).save({ + opportunityId: opportunitiesFixture[0].id, + userId: candidate!.id, + applicationRank: { + description: 'Strong JS skills', + }, + }); + + const ctx: NotificationRecruiterNewCandidateContext = { + userIds: ['2'], + opportunityId: opportunitiesFixture[0].id, + candidate: candidate!, + }; + + const notificationId = await saveNotificationV2Fixture( + con, + NotificationType.RecruiterNewCandidate, + ctx, + ); + + await expectSuccessfulBackground(worker, { + notification: { + id: notificationId, + userId: '2', + }, + }); + + expect(sendEmail).toHaveBeenCalledTimes(1); + const args = jest.mocked(sendEmail).mock + .calls[0][0] as SendEmailRequestWithTemplate; + + expect(args.message_data).toEqual({ + candidate_name: 'Ido', + profile_picture: 'https://daily.dev/ido.jpg', + job_title: 'Senior Full Stack Developer', + score: 'N/A', matching_content: 'Strong JS skills', candidate_link: `http://localhost:5002/recruiter/${opportunitiesFixture[0].id}/matches`, }); diff --git a/src/workers/newNotificationV2Mail.ts b/src/workers/newNotificationV2Mail.ts index 2da3d020d4..8ea3d6cc83 100644 --- a/src/workers/newNotificationV2Mail.ts +++ b/src/workers/newNotificationV2Mail.ts @@ -1195,8 +1195,8 @@ const notificationToTemplateData: Record = { const candidateName = candidateAvatar.name; const candidatePicture = candidateAvatar.image; const matchScore = match?.applicationRank?.score - ? `${Math.round(match.applicationRank.score)}%` - : ''; + ? `${Math.round(match.applicationRank.score)}/10` + : 'N/A'; const matchingContent = match?.applicationRank?.description || ''; return { From feb0b05856abf39b7297e4d0dabf845d64e56087 Mon Sep 17 00:00:00 2001 From: capJavert Date: Thu, 22 Jan 2026 19:48:17 +0100 Subject: [PATCH 2/3] feat: mirror slack message --- __tests__/workers/newNotificationV2Mail.ts | 4 ++-- src/workers/newNotificationV2Mail.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__tests__/workers/newNotificationV2Mail.ts b/__tests__/workers/newNotificationV2Mail.ts index 0345755da8..2616c1a350 100644 --- a/__tests__/workers/newNotificationV2Mail.ts +++ b/__tests__/workers/newNotificationV2Mail.ts @@ -2823,7 +2823,7 @@ describe('recruiter_new_candidate notification', () => { opportunityId: opportunitiesFixture[0].id, userId: candidate!.id, applicationRank: { - score: 8, + score: 8.6799, description: 'Strong JS skills', }, }); @@ -2855,7 +2855,7 @@ describe('recruiter_new_candidate notification', () => { candidate_name: 'Ido', profile_picture: 'https://daily.dev/ido.jpg', job_title: 'Senior Full Stack Developer', - score: '8/10', + score: '8.6/10', matching_content: 'Strong JS skills', candidate_link: `http://localhost:5002/recruiter/${opportunitiesFixture[0].id}/matches`, }); diff --git a/src/workers/newNotificationV2Mail.ts b/src/workers/newNotificationV2Mail.ts index 8ea3d6cc83..0fe52765f4 100644 --- a/src/workers/newNotificationV2Mail.ts +++ b/src/workers/newNotificationV2Mail.ts @@ -1195,7 +1195,7 @@ const notificationToTemplateData: Record = { const candidateName = candidateAvatar.name; const candidatePicture = candidateAvatar.image; const matchScore = match?.applicationRank?.score - ? `${Math.round(match.applicationRank.score)}/10` + ? `${match.applicationRank.score.toFixed(1)}/10` : 'N/A'; const matchingContent = match?.applicationRank?.description || ''; From 304b9fa37fd0ac3b096b5a5160c1210eeaf34709 Mon Sep 17 00:00:00 2001 From: capJavert Date: Thu, 22 Jan 2026 19:58:46 +0100 Subject: [PATCH 3/3] fix: test --- __tests__/workers/newNotificationV2Mail.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/workers/newNotificationV2Mail.ts b/__tests__/workers/newNotificationV2Mail.ts index 2616c1a350..7ce89dac3e 100644 --- a/__tests__/workers/newNotificationV2Mail.ts +++ b/__tests__/workers/newNotificationV2Mail.ts @@ -2855,7 +2855,7 @@ describe('recruiter_new_candidate notification', () => { candidate_name: 'Ido', profile_picture: 'https://daily.dev/ido.jpg', job_title: 'Senior Full Stack Developer', - score: '8.6/10', + score: '8.7/10', matching_content: 'Strong JS skills', candidate_link: `http://localhost:5002/recruiter/${opportunitiesFixture[0].id}/matches`, });