Skip to content

Commit be07bc6

Browse files
committed
update the logic of Post Interview Action Reminder
1 parent 058d6d0 commit be07bc6

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

config/default.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ module.exports = {
275275
INTERVIEW_COMPLETED_PAST_TIME: process.env.INTERVIEW_COMPLETED_PAST_TIME || 'PT4H',
276276
// The time before resource booking expiry when we should start sending notifications
277277
RESOURCE_BOOKING_EXPIRY_TIME: process.env.RESOURCE_BOOKING_EXPIRY_TIME || 'P21D',
278+
// The match window for fetching post interview actions
279+
POST_INTERVIEW_ACTION_MATCH_WINDOW: process.env.POST_INTERVIEW_ACTION_MATCH_WINDOW || 'P1D',
278280
// The Stripe
279281
STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY,
280282
CURRENCY: process.env.CURRENCY || 'usd',

scripts/demo-email-notifications/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ async function resetNotificationRecords () {
4242
const jobCandidate = await JobCandidate.findById('881a19de-2b0c-4bb9-b36a-4cb5e223bdb5')
4343
await jobCandidate.update({ status: 'interview' })
4444
const c2Interview = await Interview.findById('077aa2ca-5b60-4ad9-a965-1b37e08a5046')
45-
await c2Interview.update({ startTimestamp: completedStartTimestamp, duration, endTimestamp, guestNames: ['guest1', 'guest2'], hostName: 'hostName' })
45+
await c2Interview.update({ startTimestamp: moment().subtract(moment.duration(config.POST_INTERVIEW_ACTION_MATCH_WINDOW)).subtract(30, 'm').toDate(), duration, endTimestamp, guestNames: ['guest1', 'guest2'], hostName: 'hostName' })
46+
const jobCandidateWithinOneDay = await JobCandidate.findById('827ee401-df04-42e1-abbe-7b97ce7937ff')
47+
await jobCandidateWithinOneDay.update({ status: 'interview', jobId: 'ff76b81d-f49b-4019-b50e-c7932a818f19' })
48+
const interviewWithinOneDay = await Interview.findById('b1f7ba76-640f-47e2-9463-59e51b51ec60')
49+
await interviewWithinOneDay.update({ startTimestamp: completedStartTimestamp, duration, endTimestamp, guestNames: ['guest1', 'guest2'], hostName: 'hostName' })
4650

4751
// reset upcoming resource booking expiration records
4852
localLogger.info('reset upcoming resource booking expiration records')

src/services/NotificationsSchedulerService.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,10 @@ async function sendPostInterviewActionNotifications () {
353353
as: 'interviews',
354354
required: true,
355355
where: {
356-
status: constants.Interviews.Status.Completed
356+
status: constants.Interviews.Status.Completed,
357+
startTimestamp: {
358+
[Op.lte]: moment.utc().subtract(moment.duration(config.POST_INTERVIEW_ACTION_MATCH_WINDOW))
359+
}
357360
}
358361
}]
359362
})

0 commit comments

Comments
 (0)