Skip to content

update the logic of Post Interview Action Reminder #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ module.exports = {
INTERVIEW_COMPLETED_PAST_TIME: process.env.INTERVIEW_COMPLETED_PAST_TIME || 'PT4H',
// The time before resource booking expiry when we should start sending notifications
RESOURCE_BOOKING_EXPIRY_TIME: process.env.RESOURCE_BOOKING_EXPIRY_TIME || 'P21D',
// The match window for fetching post interview actions
POST_INTERVIEW_ACTION_MATCH_WINDOW: process.env.POST_INTERVIEW_ACTION_MATCH_WINDOW || 'P1D',
// The Stripe
STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY,
CURRENCY: process.env.CURRENCY || 'usd',
Expand Down
6 changes: 5 additions & 1 deletion scripts/demo-email-notifications/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ async function resetNotificationRecords () {
const jobCandidate = await JobCandidate.findById('881a19de-2b0c-4bb9-b36a-4cb5e223bdb5')
await jobCandidate.update({ status: 'interview' })
const c2Interview = await Interview.findById('077aa2ca-5b60-4ad9-a965-1b37e08a5046')
await c2Interview.update({ startTimestamp: completedStartTimestamp, duration, endTimestamp, guestNames: ['guest1', 'guest2'], hostName: 'hostName' })
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' })
const jobCandidateWithinOneDay = await JobCandidate.findById('827ee401-df04-42e1-abbe-7b97ce7937ff')
await jobCandidateWithinOneDay.update({ status: 'interview' })
const interviewWithinOneDay = await Interview.findById('3144fa65-ea1a-4bec-81b0-7cb1c8845826')
await interviewWithinOneDay.update({ startTimestamp: completedStartTimestamp, duration, endTimestamp, guestNames: ['guest1', 'guest2'], hostName: 'hostName' })

// reset upcoming resource booking expiration records
localLogger.info('reset upcoming resource booking expiration records')
Expand Down
5 changes: 4 additions & 1 deletion src/services/NotificationsSchedulerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ async function sendPostInterviewActionNotifications () {
as: 'interviews',
required: true,
where: {
status: constants.Interviews.Status.Completed
status: constants.Interviews.Status.Completed,
startTimestamp: {
[Op.lte]: moment.utc().subtract(moment.duration(config.POST_INTERVIEW_ACTION_MATCH_WINDOW))
}
}
}]
})
Expand Down