Fakultas Ilmu Komputer UI

Commit 7cf01973 authored by Ibnu Sofian Firdaus's avatar Ibnu Sofian Firdaus
Browse files

Implement filter by filled-out application

parent 57e01d81
...@@ -389,6 +389,17 @@ describe('VacancyList', () => { ...@@ -389,6 +389,17 @@ describe('VacancyList', () => {
expect(vacancyList.generateVacancies()).to.exist; expect(vacancyList.generateVacancies()).to.exist;
}); });
it('filters filled-out applications for stident user', () => {
const vacancyList = ReactTestUtils.renderIntoDocument(
<VacancyList items={newResponse} userId={3} user={studentUser} />,
);
vacancyList.state.vacancies = newResponse;
vacancyList.state.vacancyStateFilter = 3;
expect(vacancyList.generateVacancies()).to.exist;
vacancyList.state.vacancyStateFilter = 4;
expect(vacancyList.generateVacancies()).to.exist;
});
it('renders without problem for company', () => { it('renders without problem for company', () => {
const vacancyList = ReactTestUtils.renderIntoDocument( const vacancyList = ReactTestUtils.renderIntoDocument(
<VacancyList items={newResponse} userId={1} user={companyUser} />, <VacancyList items={newResponse} userId={1} user={companyUser} />,
......
...@@ -39,6 +39,8 @@ export default class VacancyList extends React.Component { ...@@ -39,6 +39,8 @@ export default class VacancyList extends React.Component {
{ key: 0, text: 'Semua', value: 0 }, { key: 0, text: 'Semua', value: 0 },
{ key: 1, text: 'Masih Menerima', value: 1 }, { key: 1, text: 'Masih Menerima', value: 1 },
{ key: 2, text: 'Sudah Tutup', value: 2 }, { key: 2, text: 'Sudah Tutup', value: 2 },
{ key: 3, text: 'Belum Terpenuhi', value: 3},
{ key: 4, text: 'Sudah Terpenuhi', value: 4},
], ],
sort: '', sort: '',
sortBy: [ sortBy: [
...@@ -119,6 +121,16 @@ export default class VacancyList extends React.Component { ...@@ -119,6 +121,16 @@ export default class VacancyList extends React.Component {
filteredVacancies = filteredVacancies.filter( filteredVacancies = filteredVacancies.filter(
(vacancy) => vacancy.props.data.close_time < moment().format(), (vacancy) => vacancy.props.data.close_time < moment().format(),
); );
} else if (vacancyStateFilter === 3) {
filteredVacancies = filteredVacancies.filter(
(vacancy) => vacancy.props.data.total_accepted_applicants
< vacancy.props.data.max_accepted_applicants,
);
} else if (vacancyStateFilter === 4) {
filteredVacancies = filteredVacancies.filter(
(vacancy) => vacancy.props.data.total_accepted_applicants
>= vacancy.props.data.max_accepted_applicants,
);
} }
return filteredVacancies; return filteredVacancies;
...@@ -164,6 +176,8 @@ export default class VacancyList extends React.Component { ...@@ -164,6 +176,8 @@ export default class VacancyList extends React.Component {
salary={this.props.salary} salary={this.props.salary}
/> />
)); ));
console.log(vacancies);
console.log("ini cuy")
vacancies = this.sortVacancies(vacancies); vacancies = this.sortVacancies(vacancies);
vacancies = this.filterVacanciesBasedOnSalary(vacancies); vacancies = this.filterVacanciesBasedOnSalary(vacancies);
vacancies = this.filterVacanciesBasedOnVacancyStatus(vacancies); vacancies = this.filterVacanciesBasedOnVacancyStatus(vacancies);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment