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

Commit bb8503d

Browse files
persist completed job
1 parent 55edd60 commit bb8503d

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/api/common/helper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,10 @@ async function handlePlacedJobCandidates(jobCandidates, userId) {
339339
(item) => item.userId == rb.userId && item.jobId == rb.jobId
340340
);
341341
if (jc) {
342-
// jc.completed = (new Date(rb.endDate) <= new Date()) && rb.status == 'placed'
343-
jc.completed = rb.endDate ? new Date(rb.endDate) <= new Date() : false;
342+
const completed = rb.endDate ? new Date(rb.endDate) <= new Date() : false;
343+
if (completed) {
344+
jc.status = "completed";
345+
}
344346
}
345347
});
346348
return;

src/api/services/JobApplicationService.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,18 @@ async function getMyJobApplications(currentUser, criteria) {
5353
}
5454
let jcResult = jobCandidates.result;
5555
// handle placed status for completed_jobs, archived_jobs query
56-
if (status && status == "completed_jobs") {
56+
if (status && status != "archived_jobs") {
5757
await helper.handlePlacedJobCandidates(jobCandidates.result, userId);
58-
jcResult = jobCandidates.result.filter(
59-
(item) => item.status == "placed" && item.completed
60-
);
58+
if (status == "completed_jobs") {
59+
jcResult = jobCandidates.result.filter(
60+
(item) => item.status == "completed"
61+
);
62+
}
63+
if (status == "open_jobs") {
64+
jcResult = jobCandidates.result.filter(
65+
(item) => item.status != "completed"
66+
);
67+
}
6168
}
6269

6370
const jobIds = _.map(jcResult, "jobId");

0 commit comments

Comments
 (0)