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

Commit 827b30a

Browse files
adjust archived filter
1 parent 6b6b698 commit 827b30a

File tree

3 files changed

+9
-67
lines changed

3 files changed

+9
-67
lines changed

src/api/app-constants.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ const MY_GIGS_JOB_STATUS = {
2525
CLIENT_REJECTED_INTERVIEW: "client rejected - interview",
2626
CLIENT_REJECTED_SCREENING: "client rejected - screening",
2727
JOB_CLOSED: "job-closed",
28+
WITHDRAWN: "withdrawn",
29+
WITHDRAWN_PRESCREEN: "withdrawn-prescreen",
2830
};
2931

3032
const JOB_APPLICATION_STATUS_MAPPER = {
@@ -45,19 +47,14 @@ const JOB_APPLICATION_STATUS_MAPPER = {
4547
},
4648
archived_jobs: {
4749
statuses: [
48-
MY_GIGS_JOB_STATUS.APPLIED,
49-
MY_GIGS_JOB_STATUS.SKILLS_TEST,
50-
MY_GIGS_JOB_STATUS.PHONE_SCREEN,
51-
MY_GIGS_JOB_STATUS.SCREEN_PASS,
52-
MY_GIGS_JOB_STATUS.INTERVIEW,
53-
MY_GIGS_JOB_STATUS.SELECTED,
54-
MY_GIGS_JOB_STATUS.OFFERED,
5550
MY_GIGS_JOB_STATUS.JOB_CLOSED,
5651
MY_GIGS_JOB_STATUS.REJECTED_OTHER,
5752
MY_GIGS_JOB_STATUS.REJECTED_PRE_SCREEN,
5853
MY_GIGS_JOB_STATUS.CLIENT_REJECTED_INTERVIEW,
5954
MY_GIGS_JOB_STATUS.CLIENT_REJECTED_SCREENING,
6055
MY_GIGS_JOB_STATUS.PLACED,
56+
MY_GIGS_JOB_STATUS.WITHDRAWN,
57+
MY_GIGS_JOB_STATUS.WITHDRAWN_PRESCREEN,
6158
],
6259
},
6360
};

src/api/common/helper.js

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ async function getJobCandidates(criteria) {
293293
}
294294

295295
/**
296+
* Process placed job candidate to calculate the completed status
296297
*
297298
* @param {*} jobCandidates
298299
* @param {*} userId
@@ -345,51 +346,6 @@ async function handlePlacedJobCandidates(jobCandidates, userId) {
345346
return;
346347
}
347348

348-
function handleArchivedJobCandidates(jobCandidates, jobs) {
349-
if (
350-
!jobCandidates ||
351-
jobCandidates.length == 0 ||
352-
!jobs ||
353-
jobs.length == 0
354-
) {
355-
return;
356-
}
357-
// find at least one placed jobCandidate whose job is having hoursPerWeek >= 20
358-
// if true, assign all open application with a withdraw status = true
359-
// else, assign all open application with a withdraw status = false
360-
let assignWithDraw = false;
361-
const jcs = jobCandidates.filter(
362-
(item) =>
363-
item.status == constants.MY_GIGS_JOB_STATUS.PLACED && !item.completed
364-
);
365-
_.each(jcs, (jc) => {
366-
const job = _.find(jobs, ["id", jc.jobId]);
367-
if (job.hoursPerWeek >= constants.MIN_HOUR_PER_WEEK_TO_WITHDRAW) {
368-
assignWithDraw = true;
369-
return false;
370-
}
371-
});
372-
373-
const openJobs = [
374-
constants.MY_GIGS_JOB_STATUS.APPLIED,
375-
constants.MY_GIGS_JOB_STATUS.SKILLS_TEST,
376-
constants.MY_GIGS_JOB_STATUS.PHONE_SCREEN,
377-
constants.MY_GIGS_JOB_STATUS.SCREEN_PASS,
378-
constants.MY_GIGS_JOB_STATUS.INTERVIEW,
379-
constants.MY_GIGS_JOB_STATUS.SELECTED,
380-
constants.MY_GIGS_JOB_STATUS.OFFERED,
381-
];
382-
_.each(jobCandidates, (jobCandidate) => {
383-
if (openJobs.indexOf(jobCandidate.status) >= 0) {
384-
jobCandidate.withdraw = assignWithDraw;
385-
} else if (jobCandidate.status == constants.MY_GIGS_JOB_STATUS.PLACED) {
386-
jobCandidate.withdraw = false;
387-
} else {
388-
jobCandidate.withdraw = true;
389-
}
390-
});
391-
}
392-
393349
/**
394350
* Return jobs by given criteria
395351
* @param {string} criteria the search criteria
@@ -575,7 +531,6 @@ module.exports = {
575531
getCurrentUserDetails,
576532
getJobCandidates,
577533
handlePlacedJobCandidates,
578-
handleArchivedJobCandidates,
579534
getJobs,
580535
getMember,
581536
getMemberTraits,

src/api/services/JobApplicationService.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,27 +53,17 @@ 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 != "open_jobs") {
56+
if (status && status == "completed_jobs") {
5757
await helper.handlePlacedJobCandidates(jobCandidates.result, userId);
58-
if (status == "completed_jobs") {
59-
jcResult = jobCandidates.result.filter(
60-
(item) => item.status == "placed" && item.completed
61-
);
62-
}
58+
jcResult = jobCandidates.result.filter(
59+
(item) => item.status == "placed" && item.completed
60+
);
6361
}
6462

6563
const jobIds = _.map(jcResult, "jobId");
6664
// get jobs of current user by calling taas-api
6765
const { result: jobs } = await helper.getJobs({ jobIds, page: 1, perPage });
6866

69-
if (status && status == "archived_jobs") {
70-
jcResult = jobCandidates.result.filter(
71-
(item) =>
72-
item.status != "placed" || (item.status == "placed" && !item.completed)
73-
);
74-
helper.handleArchivedJobCandidates(jcResult, jobs);
75-
jcResult = jcResult.filter((item) => item.withdraw);
76-
}
7767
// apply desired structure
7868
const jobApplications = _.map(jcResult, (jobCandidate) => {
7969
const job = _.find(jobs, ["id", jobCandidate.jobId]);

0 commit comments

Comments
 (0)