Skip to content

Commit b730ebd

Browse files
authored
fix: application rank is 0-10 (#3484)
1 parent e02d498 commit b730ebd

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

__tests__/workers/newNotificationV2Mail.ts

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2823,7 +2823,7 @@ describe('recruiter_new_candidate notification', () => {
28232823
opportunityId: opportunitiesFixture[0].id,
28242824
userId: candidate!.id,
28252825
applicationRank: {
2826-
score: 85,
2826+
score: 8.6799,
28272827
description: 'Strong JS skills',
28282828
},
28292829
});
@@ -2855,7 +2855,56 @@ describe('recruiter_new_candidate notification', () => {
28552855
candidate_name: 'Ido',
28562856
profile_picture: 'https://daily.dev/ido.jpg',
28572857
job_title: 'Senior Full Stack Developer',
2858-
score: '85%',
2858+
score: '8.7/10',
2859+
matching_content: 'Strong JS skills',
2860+
candidate_link: `http://localhost:5002/recruiter/${opportunitiesFixture[0].id}/matches`,
2861+
});
2862+
});
2863+
2864+
it('should show N/A label when no application score', async () => {
2865+
await saveFixtures(con, DatasetLocation, datasetLocationsFixture);
2866+
await saveFixtures(con, Organization, organizationsFixture);
2867+
await saveFixtures(con, Opportunity, opportunitiesFixture);
2868+
2869+
const candidate = await con.getRepository(User).findOneBy({ id: '1' });
2870+
2871+
// Create match with application rank score
2872+
await con.getRepository(OpportunityMatch).save({
2873+
opportunityId: opportunitiesFixture[0].id,
2874+
userId: candidate!.id,
2875+
applicationRank: {
2876+
description: 'Strong JS skills',
2877+
},
2878+
});
2879+
2880+
const ctx: NotificationRecruiterNewCandidateContext = {
2881+
userIds: ['2'],
2882+
opportunityId: opportunitiesFixture[0].id,
2883+
candidate: candidate!,
2884+
};
2885+
2886+
const notificationId = await saveNotificationV2Fixture(
2887+
con,
2888+
NotificationType.RecruiterNewCandidate,
2889+
ctx,
2890+
);
2891+
2892+
await expectSuccessfulBackground(worker, {
2893+
notification: {
2894+
id: notificationId,
2895+
userId: '2',
2896+
},
2897+
});
2898+
2899+
expect(sendEmail).toHaveBeenCalledTimes(1);
2900+
const args = jest.mocked(sendEmail).mock
2901+
.calls[0][0] as SendEmailRequestWithTemplate;
2902+
2903+
expect(args.message_data).toEqual({
2904+
candidate_name: 'Ido',
2905+
profile_picture: 'https://daily.dev/ido.jpg',
2906+
job_title: 'Senior Full Stack Developer',
2907+
score: 'N/A',
28592908
matching_content: 'Strong JS skills',
28602909
candidate_link: `http://localhost:5002/recruiter/${opportunitiesFixture[0].id}/matches`,
28612910
});

src/workers/newNotificationV2Mail.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,8 +1195,8 @@ const notificationToTemplateData: Record<NotificationType, TemplateDataFunc> = {
11951195
const candidateName = candidateAvatar.name;
11961196
const candidatePicture = candidateAvatar.image;
11971197
const matchScore = match?.applicationRank?.score
1198-
? `${Math.round(match.applicationRank.score)}%`
1199-
: '';
1198+
? `${match.applicationRank.score.toFixed(1)}/10`
1199+
: 'N/A';
12001200
const matchingContent = match?.applicationRank?.description || '';
12011201

12021202
return {

0 commit comments

Comments
 (0)