Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit e00c48e

Browse files
fix: completed jobs
1 parent d2de697 commit e00c48e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/api/common/helper.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,13 @@ async function handlePlacedJobCandidates(jobCandidates, userId) {
334334
// Handle placed job status with RB result
335335
const rbRes = res.body;
336336
_.each(rbRes, (rb) => {
337-
_.each(jobCandidates, (jc) => {
338-
if (rb.userId == jc.userId && rb.jobId == jc.userId) {
339-
jc.completed = rb.endDate ? new Date(rb.endDate) <= new Date() : false;
340-
}
341-
});
337+
const jc = jobCandidates.find(
338+
(item) => item.userId == rb.userId && item.jobId == rb.jobId
339+
);
340+
if (jc) {
341+
// jc.completed = (new Date(rb.endDate) <= new Date()) && rb.status == 'placed'
342+
jc.completed = rb.endDate ? new Date(rb.endDate) <= new Date() : false;
343+
}
342344
});
343345
return;
344346
}

0 commit comments

Comments
 (0)