Fakultas Ilmu Komputer UI

Commit 98bfa8ed authored by RANI LASMA ULI's avatar RANI LASMA ULI
Browse files

1606885025 70

parent 207ff3c2
......@@ -36,6 +36,7 @@ export default class CreateVacancy extends React.Component {
description: '',
requirements: '',
salary: 0,
tag: '',
};
if (this.state.vacancyId) {
......@@ -49,6 +50,7 @@ export default class CreateVacancy extends React.Component {
open_time: moment(r.open_time),
close_time: moment(r.close_time),
loading: false,
tag: r.tag,
});
});
}
......@@ -84,6 +86,7 @@ export default class CreateVacancy extends React.Component {
const data = {};
data.name = this.state.name;
data.tag = this.state.tag;
data.description = this.state.description;
data.requirements = this.state.requirements;
data.salary = this.state.salary;
......@@ -130,6 +133,10 @@ export default class CreateVacancy extends React.Component {
<CKEditor value={this.state.requirements} onChange={this.handleRequirements} /> }
<script>CKEDITOR.replace( 'requirements' );</script>
<br />
<Form.Field label="Tag" name="tag" control={Input} onChange={this.handleChange} value={this.state.tag} />
<br />
<Form.Field label="Gaji / Insentif (Rupiah per bulan)" type="number" min="0" name="salary" control={Input} onChange={this.handleChange} value={this.state.salary} />
<Form.Group widths="equal">
<Form.Field
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-12 09:54
# Generated by Django 1.11.17 on 2019-10-12 12:21
from __future__ import unicode_literals
import core.lib.validators
......@@ -37,8 +37,8 @@ class Migration(migrations.Migration):
('status', models.IntegerField(default=0)),
('logo', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_company_logo_file_path, validators=[core.lib.validators.validate_image_file_extension])),
('address', models.CharField(blank=True, max_length=1000, null=True)),
('category', models.CharField(default=b'Belum ada kategori perusahaan', max_length=140)),
('website', models.CharField(default=b'Belum ada link website', max_length=100)),
('category', models.CharField(default='Belum ada kategori perusahaan', max_length=140)),
('website', models.CharField(default='Belum ada link website', max_length=100)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
......@@ -50,7 +50,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True)),
('title', models.CharField(blank=True, default=b'', max_length=100)),
('title', models.CharField(blank=True, default='', max_length=100)),
('content', models.TextField()),
],
options={
......@@ -65,7 +65,7 @@ class Migration(migrations.Migration):
('updated', models.DateTimeField(auto_now=True)),
('npm', models.IntegerField(unique=True, validators=[core.lib.validators.validate_npm])),
('resume', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_resume_file_path, validators=[core.lib.validators.validate_document_file_extension])),
('phone_number', models.CharField(blank=True, db_index=True, max_length=100, null=True, validators=[django.core.validators.RegexValidator(b'^0\\d{1,11}$')])),
('phone_number', models.CharField(blank=True, db_index=True, max_length=100, null=True, validators=[django.core.validators.RegexValidator('^0\\d{1,11}$')])),
('gender', models.CharField(blank=True, max_length=30, null=True)),
('birth_place', models.CharField(blank=True, max_length=30, null=True)),
('birth_date', models.DateField(blank=True, null=True)),
......@@ -89,7 +89,7 @@ class Migration(migrations.Migration):
('intro', models.CharField(blank=True, max_length=50, null=True)),
('expected_salary', models.CharField(blank=True, max_length=10, null=True)),
('job_seeking_status', models.CharField(blank=True, max_length=30, null=True)),
('student_gpa', models.FloatField(blank=True, db_column=b'student_gpa', default=1.0, null=True)),
('student_gpa', models.FloatField(blank=True, db_column='student_gpa', default=1.0, null=True)),
('volunteer', models.CharField(blank=True, max_length=100, null=True)),
],
options={
......@@ -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)),
('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')),
],
......@@ -145,7 +146,7 @@ class Migration(migrations.Migration):
name='ReasonRejected',
fields=[
('application', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='core.Application')),
('reason', models.TextField(default=b'Tidak memenuhi kualifikasi perusahaan.')),
('reason', models.TextField(default='Tidak memenuhi kualifikasi perusahaan.')),
],
),
migrations.AddField(
......@@ -177,4 +178,4 @@ class Migration(migrations.Migration):
name='application',
unique_together=set([('student', 'vacancy')]),
),
]
\ No newline at end of file
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-12 12:01
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='company',
name='category',
field=models.CharField(default='Belum ada kategori perusahaan', max_length=140),
),
migrations.AlterField(
model_name='company',
name='website',
field=models.CharField(default='Belum ada link website', max_length=100),
),
migrations.AlterField(
model_name='feedback',
name='title',
field=models.CharField(blank=True, default='', max_length=100),
),
migrations.AlterField(
model_name='reasonrejected',
name='reason',
field=models.TextField(default='Tidak memenuhi kualifikasi perusahaan.'),
),
migrations.AlterField(
model_name='student',
name='phone_number',
field=models.CharField(blank=True, db_index=True, max_length=100, null=True, validators=[django.core.validators.RegexValidator('^0\\d{1,11}$')]),
),
migrations.AlterField(
model_name='student',
name='student_gpa',
field=models.FloatField(blank=True, db_column='student_gpa', default=1.0, null=True),
),
]
......@@ -16,6 +16,7 @@ class Vacancy(models.Model):
updated = models.DateTimeField(auto_now=True)
name = models.CharField(max_length=100, null=False)
amount = models.IntegerField(null=True)
tag = models.TextField(blank=True)
salary = models.IntegerField(default=0)
......
......@@ -275,4 +275,25 @@ 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')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
\ No newline at end of file
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_new_vacancy_with_tag(self):
VACANCY_TAG = "software development"
superuser = User.objects.create_superuser('dummy.company', 'dummy.company@company.com', 'lalala123')
new_company = Company.objects.create(user=superuser, description="lalalaz", status=Company.VERIFIED, logo=None,
address=None)
self.client.force_authenticate(user=superuser)
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)
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')
self.assertEqual(response.status_code, status.HTTP_200_OK)
vacancy = Vacancy.objects.first()
self.assertEqual(vacancy.tag, VACANCY_TAG)
......@@ -77,6 +77,7 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
def create(self, request):
data = request.data
print("[LOG] data: "+str(data))
company_set = Company.objects.filter(id=data['company'])
if len(company_set) == 0:
raise ValidationError('no company')
......@@ -88,13 +89,21 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
salary = data.get('salary') or 0
description = data['description']
requirements = data['requirements']
tag = ''
try:
tag = data['tag']
except:
print("Tag leaved in blank")
# if close_time < open_time:
# raise ValidationError('Waktu tutup lowongan harus lebih dari waktu buka lowongan!')
if open_time < str(datetime.today()):
raise ValidationError('Waktu buka lowongan harus lebih dari hari ini!')
elif close_time <= open_time:
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)
vacancy = Vacancy(company=company, open_time=open_time, close_time=close_time, name=name, description=description, salary=salary, tag=tag)
if 'amount' in data:
if isinstance(data['amount'], int):
vacancy.amount = data['amount']
......
File deleted
......@@ -4608,6 +4608,11 @@
"eslint-visitor-keys": "^1.1.0"
}
},
"esprima": {
"version": "github:substack/esprima#0a7f8489a11b44b019ce168506f535f22d0be290",
"from": "github:substack/esprima#is-keyword",
"dev": true
},
"esquery": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz",
......@@ -4942,11 +4947,8 @@
"resolved": "https://registry.npmjs.org/falafel/-/falafel-0.2.1.tgz",
"integrity": "sha1-nvxRzhnsVykIayKuiJ5dfQ4lZgE=",
"dev": true,
"dependencies": {
"esprima": {
"version": "github:substack/esprima#0a7f8489a11b44b019ce168506f535f22d0be290",
"from": "github:substack/esprima#0a7f8489a11b44b019ce168506f535f22d0be290"
}
"requires": {
"esprima": "github:substack/esprima#is-keyword"
}
},
"fast-deep-equal": {
......
home = C:\Users\Z\AppData\Local\Programs\Python\Python37
include-system-site-packages = false
version = 3.7.4
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