Skip to content

Commit 9ace73e

Browse files
authored
Merge branch 'dev' into fix-issues-540
2 parents ae96099 + 3c04b80 commit 9ace73e

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

data/demo-data.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"a2b4bc11-c641-4a19-9eb7-33980378f82e"
2020
],
2121
"status": "in-review",
22-
"isApplicationPageActive": false,
22+
"isApplicationPageActive": true,
2323
"minSalary": 100,
2424
"maxSalary": 200,
2525
"hoursPerWeek": 20,
@@ -51,7 +51,7 @@
5151
"a2b4bc11-c641-4a19-9eb7-33980378f82e"
5252
],
5353
"status": "in-review",
54-
"isApplicationPageActive": false,
54+
"isApplicationPageActive": true,
5555
"minSalary": 100,
5656
"maxSalary": 200,
5757
"hoursPerWeek": 80,
@@ -83,7 +83,7 @@
8383
"a2b4bc11-c641-4a19-9eb7-33980378f82e"
8484
],
8585
"status": "in-review",
86-
"isApplicationPageActive": false,
86+
"isApplicationPageActive": true,
8787
"minSalary": 100,
8888
"maxSalary": 200,
8989
"hoursPerWeek": 90,
@@ -115,7 +115,7 @@
115115
"a2b4bc11-c641-4a19-9eb7-33980378f82e"
116116
],
117117
"status": "in-review",
118-
"isApplicationPageActive": false,
118+
"isApplicationPageActive": true,
119119
"minSalary": 100,
120120
"maxSalary": 200,
121121
"hoursPerWeek": 20,
@@ -148,7 +148,7 @@
148148
"0b104b7c-0792-4118-8bc7-a274e9ee19e3"
149149
],
150150
"status": "closed",
151-
"isApplicationPageActive": false,
151+
"isApplicationPageActive": true,
152152
"minSalary": null,
153153
"maxSalary": null,
154154
"hoursPerWeek": null,

docs/swagger.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ paths:
118118
schema:
119119
type: integer
120120
description: The project id.
121+
- in: query
122+
name: isApplicationPageActive
123+
required: false
124+
schema:
125+
type: boolean
126+
description: Is application page active.
121127
- in: query
122128
name: projectIds
123129
required: false

scripts/demo-email-notifications/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ async function resetNotificationRecords () {
3636
const duration = 30
3737
const completedEndTimestamp = moment(completedStartTimestamp).clone().add(30, 'm').toDate()
3838
await completedInterview.update({ startTimestamp: completedStartTimestamp, duration, endTimeStamp: completedEndTimestamp, status: Interviews.Status.Scheduled, guestNames: ['guest1', 'guest2'], hostName: 'hostName' })
39+
const completedInterview2 = await Interview.findById('3144fa65-ea1a-4bec-81b0-7cb1c8845826')
40+
await completedInterview2.update({ startTimestamp: completedStartTimestamp, duration, endTimeStamp: completedEndTimestamp, status: Interviews.Status.Scheduled, guestNames: ['guest1', 'guest2'], hostName: 'hostName' })
3941

4042
// reset post interview candidate action reminder records
4143
localLogger.info('reset post interview candidate action reminder records')

src/services/JobService.js

+3
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false }
453453
}
454454

455455
_.each(_.pick(criteria, [
456+
'isApplicationPageActive',
456457
'projectId',
457458
'externalId',
458459
'description',
@@ -532,6 +533,7 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false }
532533
logger.info({ component: 'JobService', context: 'searchJobs', message: 'fallback to DB query' })
533534
const filter = { [Op.and]: [] }
534535
_.each(_.pick(criteria, [
536+
'isApplicationPageActive',
535537
'projectId',
536538
'externalId',
537539
'startDate',
@@ -595,6 +597,7 @@ searchJobs.schema = Joi.object().keys({
595597
sortOrder: Joi.string().valid('desc', 'asc'),
596598
projectId: Joi.number().integer(),
597599
externalId: Joi.string(),
600+
isApplicationPageActive: Joi.boolean(),
598601
description: Joi.string(),
599602
title: Joi.title(),
600603
startDate: Joi.date(),

src/services/NotificationsSchedulerService.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ async function sendInterviewCompletedNotifications () {
324324
})
325325
interviews = _.map(_.values(_.groupBy(interviews, 'jobCandidateId')), (interviews) => _.maxBy(interviews, 'round'))
326326

327+
const jobCandidates = await JobCandidate.findAll({ where: { id: _.map(interviews, 'jobCandidateId') } })
328+
const jcMap = _.keyBy(jobCandidates, 'id')
329+
327330
localLogger.debug(`[sendInterviewCompletedNotifications]: Found ${interviews.length} interviews which must be ended by now.`)
328331

329332
let sentCount = 0
@@ -332,8 +335,12 @@ async function sendInterviewCompletedNotifications () {
332335
localLogger.error(`Interview id: ${interview.id} host email not present`)
333336
continue
334337
}
338+
if (!jcMap[interview.jobCandidateId] || jcMap[interview.jobCandidateId].status !== constants.JobCandidateStatus.INTERVIEW) {
339+
localLogger.error(`Interview id: ${interview.id} job candidate status is not ${constants.JobCandidateStatus.INTERVIEW}`)
340+
continue
341+
}
335342

336-
const data = await getDataForInterview(interview)
343+
const data = await getDataForInterview(interview, jcMap[interview.jobCandidateId])
337344
if (!data) { continue }
338345

339346
sendNotification({}, {

0 commit comments

Comments
 (0)