Skip to content

Commit 6f139ac

Browse files
committed
fix: Job assigned auto-logic
1 parent 8eca930 commit 6f139ac

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/eventHandlers/ResourceBookingEventHandler.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,24 @@ async function placeJobCandidate (payload) {
6969
}
7070

7171
/**
72-
* Update the status of the Job to placed when it positions requirement is fullfilled.
72+
* Update the status of the Job to assigned when it positions requirement is fulfilled.
7373
*
7474
* @param {Object} payload the event payload
7575
* @returns {undefined}
7676
*/
77-
async function placeJob (payload) {
77+
async function assignJob (payload) {
7878
if (_.get(payload, 'options.oldValue') && payload.value.status === payload.options.oldValue.status) {
7979
logger.debug({
8080
component: 'ResourceBookingEventHandler',
81-
context: 'placeJob',
81+
context: 'assignJob',
8282
message: 'status not changed'
8383
})
8484
return
8585
}
8686
if (payload.value.status !== 'placed') {
8787
logger.debug({
8888
component: 'ResourceBookingEventHandler',
89-
context: 'placeJob',
89+
context: 'assignJob',
9090
message: `not interested resource booking - status: ${payload.value.status}`
9191
})
9292
return
@@ -95,7 +95,7 @@ async function placeJob (payload) {
9595
if (!resourceBooking.jobId) {
9696
logger.debug({
9797
component: 'ResourceBookingEventHandler',
98-
context: 'placeJob',
98+
context: 'assignJob',
9999
message: `id: ${resourceBooking.id} resource booking without jobId - ignored`
100100
})
101101
return
@@ -104,7 +104,7 @@ async function placeJob (payload) {
104104
if (job.status === 'placed') {
105105
logger.debug({
106106
component: 'ResourceBookingEventHandler',
107-
context: 'placeJob',
107+
context: 'assignJob',
108108
message: `job with projectId ${job.projectId} is already placed`
109109
})
110110
return
@@ -117,12 +117,12 @@ async function placeJob (payload) {
117117
})
118118
logger.debug({
119119
component: 'ResourceBookingEventHandler',
120-
context: 'placeJob',
120+
context: 'assignJob',
121121
message: `the number of placed resource bookings is ${resourceBookings.length} - the numPositions of the job is ${job.numPositions}`
122122
})
123123
if (job.numPositions === resourceBookings.length) {
124-
await JobService.partiallyUpdateJob(helper.getAuditM2Muser(), job.id, { status: 'placed' })
125-
logger.info({ component: 'ResourceBookingEventHandler', context: 'placeJob', message: `job ${job.id} is placed` })
124+
await JobService.partiallyUpdateJob(helper.getAuditM2Muser(), job.id, { status: 'assigned' })
125+
logger.info({ component: 'ResourceBookingEventHandler', context: 'assignJob', message: `job ${job.id} is assigned` })
126126
}
127127
}
128128

@@ -295,7 +295,7 @@ async function _deleteWorkPeriods (workPeriods) {
295295
*/
296296
async function processCreate (payload) {
297297
await placeJobCandidate(payload)
298-
await placeJob(payload)
298+
await assignJob(payload)
299299
await createWorkPeriods(payload)
300300
}
301301

@@ -307,7 +307,7 @@ async function processCreate (payload) {
307307
*/
308308
async function processUpdate (payload) {
309309
await placeJobCandidate(payload)
310-
await placeJob(payload)
310+
await assignJob(payload)
311311
await updateWorkPeriods(payload)
312312
}
313313

0 commit comments

Comments
 (0)