Skip to content

Commit 01e8e02

Browse files
authored
Merge pull request #518 from xxcxy/fix-issues-515
update the logic of Post Interview Action Reminder
2 parents 3ba9ef3 + 2f6b92e commit 01e8e02

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' })
48+
const interviewWithinOneDay = await Interview.findById('3144fa65-ea1a-4bec-81b0-7cb1c8845826')
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
@@ -357,7 +357,10 @@ async function sendPostInterviewActionNotifications () {
357357
as: 'interviews',
358358
required: true,
359359
where: {
360-
status: constants.Interviews.Status.Completed
360+
status: constants.Interviews.Status.Completed,
361+
startTimestamp: {
362+
[Op.lte]: moment.utc().subtract(moment.duration(config.POST_INTERVIEW_ACTION_MATCH_WINDOW))
363+
}
361364
}
362365
}]
363366
})

0 commit comments

Comments
 (0)