Fakultas Ilmu Komputer UI

Commit 6d40f402 authored by Wildan Fahmi's avatar Wildan Fahmi
Browse files

1606889591-62 Sebagai pelamar, saya ingin melihat jangka waktu kerja dari sebuah lowongan

parent 05264c6f
......@@ -92,6 +92,7 @@ export default class CreateVacancy extends React.Component {
data.salary = this.state.salary;
data.open_time = this.state.open_time.format();
data.close_time = this.state.close_time.format();
data.working_period = this.state.working_period;
if (!this.state.vacancyId) {
data.company = this.state.company.id;
}
......@@ -123,6 +124,7 @@ export default class CreateVacancy extends React.Component {
{ !this.state.loading &&
<CKEditor value={this.state.description} onChange={this.handleDescription} /> }
<script>CKEDITOR.replace( 'description' );</script>
<Form.Field label="Periode Kerja" name="working_period" control={Input} onChange={this.handleChange} value={this.state.working_period} />
<label htmlFor="responsibilities"> <b> Tanggung Jawab Lowongan </b> </label>
{ !this.state.loading &&
<CKEditor value={this.state.responsibilities} onChange={this.handleResponsibilities} /> }
......
......@@ -23,6 +23,7 @@ describe('Vacancy', () => {
name: 'Software Engineer',
open_time: '2017-03-28T05:55:38Z',
updated: '2017-03-28T07:34:13.122093Z',
working_period: 'Juli-Agustus',
verified: true,
};
......@@ -43,6 +44,7 @@ describe('Vacancy', () => {
name: 'Software Engineer',
open_time: '2017-03-28T05:55:38Z',
updated: '2017-03-28T07:34:13.122093Z',
working_period: 'Oktober-Desember',
verified: true,
};
......
......@@ -145,6 +145,7 @@ describe('VacancyList', () => {
status: 0,
bookmarked: false,
id: 4,
working_period: 'Juli-Agustus',
},
{
company: {
......@@ -176,6 +177,7 @@ describe('VacancyList', () => {
status: 1,
bookmarked: false,
id: 4,
working_period: 'Juli-Agustus',
},
{
company: {
......@@ -207,6 +209,7 @@ describe('VacancyList', () => {
status: 2,
bookmarked: true,
id: 4,
working_period: 'Juli-Agustus',
},
{
company: {
......@@ -238,6 +241,7 @@ describe('VacancyList', () => {
status: 3,
bookmarked: true,
id: 4,
working_period: 'Juli-Agustus',
},
{
company: {
......@@ -269,6 +273,7 @@ describe('VacancyList', () => {
status: 4,
bookmarked: true,
id: 4,
working_period: 'Juli-Agustus',
},
];
......@@ -290,6 +295,7 @@ describe('VacancyList', () => {
open_time: '2017-03-28T05:55:38Z',
updated: '2017-03-28T07:34:13.122093Z',
verified: true,
working_period: 'Juli-Agustus',
}, {
salary: '1',
close_time: '2019-03-28T05:55:42Z',
......@@ -308,6 +314,7 @@ describe('VacancyList', () => {
open_time: '2017-03-28T05:55:38Z',
updated: '2017-03-28T07:34:13.122093Z',
verified: true,
working_period: 'Juli-Agustus',
}];
const response2 = [{
......@@ -328,6 +335,7 @@ describe('VacancyList', () => {
open_time: '2017-03-28T05:55:38Z',
updated: '2017-03-28T07:34:13.122093Z',
verified: true,
working_period: 'Juli-Agustus',
}];
it('renders without problem', () => {
......
......@@ -136,6 +136,7 @@ export default class Vacancy extends React.Component {
<h4>{ this.props.data.name }</h4>
{ this.props.data.company.name }<br />
{ this.props.data.company.address }<br />
{ this.props.data.working_period}<br />
{ this.state.count } orang telah mendaftar!<br />
<b>{`Ditutup ${moment(moment(this.props.data.close_time)).fromNow()}`}</b><br />
Rp. { this.props.data.salary } <br />
......
......@@ -123,6 +123,7 @@ class Migration(migrations.Migration):
('updated', models.DateTimeField(auto_now=True)),
('name', models.CharField(max_length=100)),
('amount', models.IntegerField(null=True)),
('working_period', models.CharField(max_length=100, null=True)),
('tag', models.TextField(blank=True)),
('salary', models.IntegerField(default=0)),
('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='vacancies', to='core.Company')),
......
......@@ -16,10 +16,10 @@ class Vacancy(models.Model):
updated = models.DateTimeField(auto_now=True)
name = models.CharField(max_length=100, null=False)
amount = models.IntegerField(null=True)
working_period = models.CharField(max_length=100, null=True)
tag = models.TextField(blank=True)
salary = models.IntegerField(default=0)
@property
def apply_before(self):
if(self.close_time<timezone.now()):
......
......@@ -33,7 +33,7 @@ class VacancySerializer(serializers.ModelSerializer):
class Meta:
model = Vacancy
fields = ['company', 'verified', 'open_time', 'description', 'close_time', 'created','apply_before', 'updated', 'name', \
'status', 'bookmarked', 'id', 'salary', 'responsibilities', 'requirements']
'status', 'bookmarked', 'id', 'salary', 'responsibilities', 'requirements','working_period']
def name_position_validator(names):
for name in names.split(" "):
......
......@@ -23,7 +23,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/'
response = self.client.post(url, {'company': new_company.pk, 'open_time': self.today,
'close_time': self.tomorrow, 'name': 'new vacancy', 'description': 'new_vacancy ', 'requirements': 'new_vacancy'}, format='json')
'close_time': self.tomorrow, 'name': 'new vacancy', 'description': 'new_vacancy', 'requirements': 'new_vacancy', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
vacancies = Vacancy.objects.count()
......@@ -38,7 +38,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/'
response = self.client.post(url, {'company': new_company.pk, 'open_time': self.today,
'close_time': self.tomorrow, 'name': 'new vacancy',
'description': 'new_vacancy ', 'amount': 10, 'requirements': 'new_vacancy'}, format='json')
'description': 'new_vacancy ', 'amount': 10, 'requirements': 'new_vacancy', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
vacancy = Vacancy.objects.first()
......@@ -54,7 +54,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/'
response = self.client.post(url, {'company': new_company.pk, 'open_time': self.today,
'close_time': self.tomorrow, 'name': 'new vacancy',
'description': 'new_vacancy ', 'amount': 10, 'responsibilities': 'new_vacancy', 'requirements':'new_vacancy'}, format='json')
'description': 'new_vacancy ', 'amount': 10, 'responsibilities': 'new_vacancy', 'requirements':'new_vacancy', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
vacancy = Vacancy.objects.first()
......@@ -68,7 +68,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/'
response = self.client.post(url, {'company': new_company.pk, 'open_time': self.today,
'close_time': self.yesterday, 'name': 'new_vacancy', 'description': 'new_vacancy', 'responsibilities': 'new_vacancy', 'requirements': 'new_vacancy'}, format='json')
'close_time': self.yesterday, 'name': 'new_vacancy', 'description': 'new_vacancy', 'responsibilities': 'new_vacancy', 'requirements': 'new_vacancy', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
vacancies = Vacancy.objects.count()
......@@ -83,7 +83,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/'
response = self.client.post(url, {'company': new_company.pk, 'open_time': self.today,
'close_time': self.tomorrow, 'name': 'new_vacancy',
'description': 'new_vacancy ', 'amount': 'sepuluh', 'salary':'dua juta', 'requirements': 'new_vacancy'}, format='json')
'description': 'new_vacancy ', 'amount': 'sepuluh', 'salary':'dua juta', 'requirements': 'new_vacancy', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
vacancies_count = Vacancy.objects.count()
......@@ -100,7 +100,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.patch(url, {'open_time': self.today, 'close_time': self.tomorrow,
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'responsibilities': 'new_vacancy2', 'requirements': 'new_vacancy2'}, format='json')
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'responsibilities': 'new_vacancy2', 'requirements': 'new_vacancy2', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_update_vacancy_with_amount_salary_success(self):
......@@ -114,7 +114,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.patch(url, {'open_time': self.today, 'close_time': self.tomorrow,
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'amount': 10, 'salary': 2, 'responsibilities': 'new_vacancy2', 'requirements': 'new_vacancy2'}, format='json')
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'amount': 10, 'salary': 2, 'responsibilities': 'new_vacancy2', 'requirements': 'new_vacancy2', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
vacancy = Vacancy.objects.first()
......@@ -131,7 +131,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.patch(url, {'open_time': self.today, 'close_time': self.tomorrow,
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'amount': 10, 'responsibilities': 'new_vacancy2', 'requirements': 'new_vacancy2'}, format='json')
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'amount': 10, 'responsibilities': 'new_vacancy2', 'requirements': 'new_vacancy2', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
vacancy = Vacancy.objects.first()
......@@ -148,7 +148,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.patch(url, {'open_time': self.today, 'close_time': self.yesterday,
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'responsibilities': 'new_vacancy2', 'requirements': 'new_vacancy2'}, format='json')
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'responsibilities': 'new_vacancy2', 'requirements': 'new_vacancy2', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_update_vacancy_with_amount_salary_string_failed(self):
......@@ -162,7 +162,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.patch(url, {'open_time': self.today, 'close_time': self.yesterday,
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'amount': 'sepuluh', 'salary': 'dua juta', 'requirements': 'new_vacancy'}, format='json')
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'amount': 'sepuluh', 'salary': 'dua juta', 'requirements': 'new_vacancy', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
vacancy = Vacancy.objects.first()
......@@ -176,7 +176,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/'
response = self.client.post(url, {'company': new_company.pk, 'open_time': self.today,
'close_time': self.today, 'name': 'new_vacancy', 'description': 'new_vacancy'}, format='json')
'close_time': self.today, 'name': 'new_vacancy', 'description': 'new_vacancy', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
......@@ -191,7 +191,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/'
response = self.client.post(url, {'company': new_company.pk, 'open_time': datetime.fromtimestamp(0),
'close_time': datetime.fromtimestamp(0), 'name': 'new_vacancy', 'description': 'new_vacancy'}, format='json')
'close_time': datetime.fromtimestamp(0), 'name': 'new_vacancy', 'description': 'new_vacancy', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
......@@ -210,7 +210,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.patch(url, {'open_time': self.today, 'close_time': self.today,
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'requirements': 'new_vacancy2'}, format='json')
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'requirements': 'new_vacancy2', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
......@@ -226,7 +226,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.patch(url, {'open_time': datetime.fromtimestamp(0), 'close_time': datetime.fromtimestamp(0),
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'amount': 'sepuluh', 'requirements': 'new_vacancy2'}, format='json')
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'amount': 'sepuluh', 'requirements': 'new_vacancy2', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
vacancy = Vacancy.objects.first()
......@@ -243,7 +243,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.patch(url, {'open_time': self.today, 'close_time': self.tomorrow,
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'responsibilities': 'new_vacancy2', 'amount': 'sepuluh', 'requirements': 'new_vacancy2'}, format='json')
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'responsibilities': 'new_vacancy2', 'amount': 'sepuluh', 'requirements': 'new_vacancy2', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
vacancy = Vacancy.objects.first()
......@@ -257,7 +257,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/'
response = self.client.post(url, {'company': new_company.pk, 'open_time': self.yesterday,
'close_time': self.today, 'name': 'new_vacancy', 'description': 'new_vacancy', 'responsibilities': 'new_vacancy', 'requirements': 'new_vacancy'}, format='json')
'close_time': self.today, 'name': 'new_vacancy', 'description': 'new_vacancy', 'responsibilities': 'new_vacancy', 'requirements': 'new_vacancy', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
vacancies = Vacancy.objects.count()
......@@ -274,7 +274,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
url = '/api/vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.patch(url, {'open_time': self.yesterday, 'close_time': self.today,
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'responsibilities': 'new_vacancy2', 'requirements': 'new_vacancy2'}, format='json')
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'responsibilities': 'new_vacancy2', 'requirements': 'new_vacancy2','working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_new_vacancy_with_tag(self):
......@@ -287,11 +287,11 @@ class CreateAndUpdateVacancyTest(APITestCase):
new_vacancy = Vacancy.objects.create(company=new_company, verified=False, open_time= self.today,
description="lalala", close_time=self.tomorrow, name='new_company',
tag=VACANCY_TAG)
tag=VACANCY_TAG, working_period="3 Bulan")
url = '/api/vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.patch(url, {'open_time': self.today, 'close_time': self.tomorrow,
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'amount': 10, 'responsibilities': 'new_vacancy2', 'requirements': 'new_vacancy2'}, format='json')
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'amount': 10, 'responsibilities': 'new_vacancy2', 'requirements': 'new_vacancy2','working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
vacancy = Vacancy.objects.first()
......
......@@ -112,7 +112,7 @@ class ApplicationTests(APITestCase):
new_company = Company.objects.create(user=new_user, description="lalala", status=Company.VERIFIED, logo=None,
address=None)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(1541319300.0),
description="lalala", requirements= "requirements", close_time=(timezone.now() + timedelta(days=1)))
description="lalala",working_period="3 Bulan", requirements= "requirements", close_time=(timezone.now() + timedelta(days=1)))
url = '/api/students/' + str(student_id) + '/applied-vacancies/'
response = self.client.post(url, {'vacancy_id': new_vacancy.pk, 'cover_letter': 'this is a cover letter.'},
......@@ -135,7 +135,7 @@ class ApplicationTests(APITestCase):
new_student = Student.objects.create(user=new_user2, npm=1234123412)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(0),
description="lalala", close_time=datetime.today())
description="lalala",working_period="3 Bulan" ,close_time=datetime.today())
application = Application.objects.create(student=new_student, vacancy=new_vacancy, cover_letter="lorem ipsum")
......@@ -157,7 +157,7 @@ class ApplicationTests(APITestCase):
address=None)
new_student = Student.objects.create(user=new_user2, npm=1234123412)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(0),
description="lalala", close_time=datetime.today())
description="lalala", working_period="3 Bulan",close_time=datetime.today())
url = '/api/applications/' + str(new_vacancy.pk) + '/count/'
......@@ -196,7 +196,7 @@ class ApplicationTests(APITestCase):
new_company = Company.objects.create(user=new_user, description="lalala", status=Company.VERIFIED, logo=None,
address=None)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(0),
description="lalala", close_time=(timezone.now() - timedelta(days=1)))
description="lalala", working_period="3 Bulan",close_time=(timezone.now() - timedelta(days=1)))
url = '/api/students/' + str(student_id) + '/applied-vacancies/'
response = self.client.post(url, {'vacancy_id': new_vacancy.pk, 'cover_letter': 'this is a cover letter.'},
format='json')
......@@ -308,7 +308,7 @@ class BookmarkApplicationTests(APITestCase):
new_company = Company.objects.create(user=new_user, description="lalala", status=Company.VERIFIED, logo=None,
address=None)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, requirements= "requirements", open_time=datetime.fromtimestamp(1541319300.0),
description="lalala", close_time=timezone.now())
description="lalala", working_period="3 Bulan",close_time=timezone.now())
url = '/api/students/' + str(student_id) + '/bookmarked-vacancies/'
response = self.client.post(url, {'vacancy_id': new_vacancy.pk}, format='json')
......@@ -332,8 +332,8 @@ class VacancyTest(APITestCase):
def test_search_vacancy(self, m):
superuser = User.objects.create_user('dummy.company', 'dummy.company@company.com', 'lalala123')
company = Company.objects.create(user=superuser, description="This is a test company")
Vacancy.objects.create(company=company, open_time=datetime.now(), close_time=datetime.now(), name="Software Engineer")
Vacancy.objects.create(company=company, open_time=datetime.now(), close_time=datetime.now(), name="Data Engineer")
Vacancy.objects.create(company=company, open_time=datetime.now(), close_time=datetime.now(), name="Software Engineer",working_period="3 Bulan")
Vacancy.objects.create(company=company, open_time=datetime.now(), close_time=datetime.now(), name="Data Engineer",working_period="3 Bulan")
m.get('https://akun.cs.ui.ac.id/oauth/token/verify/?client_id=X3zNkFmepkdA47ASNMDZRX3Z9gqSU1Lwywu5WepG',
json={"username": 'dummy.mahasiswa', "role": 'mahasiswa', "identity_number": '1234567890'},
status_code=200)
......@@ -389,9 +389,9 @@ class VacancyTest(APITestCase):
open_time = datetime(2019, 10, 20)
close_time = datetime(2019, 12, 20)
vacancy1 = Vacancy.objects.create(company=new_company, verified=True, open_time=open_time,
description='', close_time=close_time, name='vacancy1')
description='', close_time=close_time, name='vacancy1',working_period="3 Bulan")
vacancy2 = Vacancy.objects.create(company=new_company2, verified=True, open_time=open_time,
description='', close_time=close_time, name='vacancy2')
description='', close_time=close_time, name='vacancy2',working_period="3 Bulan")
url = '/api/vacancies/?company={}&company={}'.format(new_company.id, new_company2.id)
response = self.client.get(url, format='json')
vacancies = Vacancy.objects.filter(company__id__in=[new_company.id, new_company2.id])
......@@ -451,7 +451,7 @@ class VacancyTest(APITestCase):
new_company = Company.objects.create(user=new_user, description="lalala", status=Company.VERIFIED, logo=None,
address=None)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(1541319300.0),
description="expired vacancy", close_time=datetime.fromtimestamp(1541319301.0))
description="expired vacancy", close_time=datetime.fromtimestamp(1541319301.0),working_period="3 Bulan")
url = '/api/vacancies/?opened_only=true'
response = self.client.get(url, format='json')
......@@ -465,7 +465,7 @@ class VacancyTest(APITestCase):
address=None)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(0),
description="lalala", close_time=timezone.now() - timedelta(minutes = 10))
description="lalala", close_time=timezone.now() - timedelta(minutes = 10),working_period="3 Bulan")
self.client.force_authenticate(user=superuser)
response = new_vacancy.apply_before
......@@ -478,7 +478,7 @@ class VacancyTest(APITestCase):
address=None)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(0),
description="lalala", close_time=timezone.now() + timedelta(minutes = 10))
description="lalala", close_time=timezone.now() + timedelta(minutes = 10),working_period="3 Bulan")
self.client.force_authenticate(user=superuser)
response = new_vacancy.apply_before
......@@ -562,7 +562,7 @@ class CompanyListsTests(APITestCase):
new_student = Student.objects.create(user=new_user2, npm=1234123412)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(1541319300.0),
description="lalala", requirements= "requirements", close_time=timezone.now())
description="lalala", requirements= "requirements", close_time=timezone.now(),working_period="3 Bulan")
new_app = Application.objects.create(student=new_student, vacancy=new_vacancy, cover_letter="asdasdasd")
self.client.force_authenticate(new_user)
......@@ -580,7 +580,7 @@ class CompanyListsTests(APITestCase):
new_student = Student.objects.create(user=new_user2, npm=1234123412)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(1541319300.0),
description="lalala", requirements= "requirements", close_time=timezone.now())
description="lalala", requirements= "requirements", close_time=timezone.now(),working_period="3 Bulan")
new_app = Application.objects.create(student=new_student, vacancy=new_vacancy, cover_letter="asdasdasd")
new_user3 = User.objects.create_user('dummy.company4', 'dummy.company4@company.com', 'lalala123')
......@@ -602,7 +602,7 @@ class CompanyListsTests(APITestCase):
new_student = Student.objects.create(user=new_user2, npm=1234123412)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(1541319300.0),
description="lalala", requirements= "requirements", close_time=timezone.now())
description="lalala", requirements= "requirements", close_time=timezone.now(),working_period="3 Bulan")
new_app = Application.objects.create(student=new_student, vacancy=new_vacancy, cover_letter="asdasdasd")
new_user3 = User.objects.create_user('dummy.company4', 'dummy.company4@company.com', 'lalala123')
......@@ -624,7 +624,7 @@ class CompanyListsTests(APITestCase):
new_student = Student.objects.create(user=new_user2, npm=1234123412)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(1541319300.0),
description="lalala", requirements= "requirements", close_time=timezone.now())
description="lalala", requirements= "requirements", close_time=timezone.now(),working_period="3 Bulan")
new_app = Application.objects.create(student=new_student, vacancy=new_vacancy, cover_letter="asdasdasd")
self.client.force_authenticate(new_user)
......@@ -642,7 +642,7 @@ class CompanyListsTests(APITestCase):
new_student = Student.objects.create(user=new_user2, npm=1234123412)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(1541319300.0),
description="lalala", requirements= "requirements", close_time=timezone.now())
description="lalala", requirements= "requirements", close_time=timezone.now(),working_period="3 Bulan")
new_app = Application.objects.create(student=new_student, vacancy=new_vacancy, cover_letter="asdasdasd")
self.client.force_authenticate(new_user)
......@@ -661,7 +661,7 @@ class CompanyListsTests(APITestCase):
new_student = Student.objects.create(user=new_user2, npm=1234123412)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(1541319300.0),
description="lalala", requirements= "requirements", close_time=timezone.now())
description="lalala", requirements= "requirements", close_time=timezone.now(),working_period="3 Bulan")
new_app = Application.objects.create(student=new_student, vacancy=new_vacancy, cover_letter="asdasdasd")
self.client.force_authenticate(new_user)
......@@ -680,7 +680,7 @@ class CompanyListsTests(APITestCase):
new_student = Student.objects.create(user=new_user2, npm=1234123412)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(1541319300.0),
description="lalala", requirements= "requirements", close_time=timezone.now())
description="lalala", requirements= "requirements", close_time=timezone.now(),working_period="3 Bulan")
new_app = Application.objects.create(student=new_student, vacancy=new_vacancy, cover_letter="asdasdasd")
self.client.force_authenticate(new_user)
......
......@@ -88,6 +88,7 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
self.name_position_validator(name)
salary = data.get('salary') or 0
description = data['description']
working_period = data['working_period']
requirements = data['requirements']
tag = ''
try:
......@@ -103,7 +104,7 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
raise ValidationError('Waktu tutup lowongan harus lebih dari waktu buka lowongan dan tidak sama dengan waktu pembukaan lowongan!')
elif close_time == open_time:
raise ValidationError('Waktu tutup dan buka lowongan tidak boleh sama!')
vacancy = Vacancy(company=company, open_time=open_time, close_time=close_time, name=name, description=description, salary=salary, tag=tag)
vacancy = Vacancy(company=company, open_time=open_time, close_time=close_time, name=name, description=description, salary=salary, working_period=working_period, tag=tag)
if 'amount' in data:
if isinstance(data['amount'], int):
vacancy.amount = data['amount']
......@@ -125,6 +126,7 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
close_time = data['close_time']
name = data['name']
description = data['description']
working_period = data['working_period']
requirements = data['requirements']
if open_time < str(datetime.today()):
raise ValidationError('Waktu buka lowongan harus lebih dari hari ini!')
......@@ -137,6 +139,7 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
vacancy.name = name
vacancy.salary = salary
vacancy.description = description
vacancy.working_period = working_period
vacancy.responsibilities = data.get('responsibilities')
vacancy.requirements = requirements
if 'amount' in data:
......
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