Fakultas Ilmu Komputer UI

Commit e860d246 authored by Hema Mitta Kalyani's avatar Hema Mitta Kalyani
Browse files

1606827706 140

parent 61e21bdc
......@@ -69,6 +69,7 @@ export default class ProfilePage extends React.Component {
certification: '',
languages: '',
seminar: '',
interests: '',
},
bagikanTranskrip: '',
acceptedNo: 0,
......@@ -88,6 +89,7 @@ export default class ProfilePage extends React.Component {
certification: '',
languages: '',
seminar: '',
interests: '',
dependants: '',
};
this.getProfile = this.getProfile.bind(this);
......@@ -147,6 +149,7 @@ export default class ProfilePage extends React.Component {
certification: data.certification,
languages: data.languages,
seminar: data.seminar,
interests: data.interests,
});
if (this.props.route.own) {
const newSession = this.props.user.data;
......@@ -577,6 +580,16 @@ export default class ProfilePage extends React.Component {
/>
</Form.Field>
<Form.Field>
<label htmlFor="interests">Interests</label>
<input
onChange={this.handleChange}
placeholder={this.state.interests === null ? 'Machine Learning' : this.state.interests}
defaultValue={this.state.interests === null ? null : this.state.interests}
name="interests"
/>
</Form.Field>
<Form.Field>
<label htmlFor="resume">Resume</label>
<input
......
......@@ -72,6 +72,7 @@ export default class ProfilePage extends React.Component {
certification: '',
languages: '',
seminar: '',
interests: '',
},
bagikanTranskrip: '',
acceptedNo: 0,
......@@ -91,6 +92,7 @@ export default class ProfilePage extends React.Component {
certification: '',
languages: '',
semimar: '',
interests: '',
dependants: '',
};
this.getProfile = this.getProfile.bind(this);
......@@ -150,6 +152,7 @@ export default class ProfilePage extends React.Component {
certification: data.certification,
languages: data.languages,
seminar: data.seminar,
interests: data.interests,
dependants: data.dependants,
});
if (this.props.route.own) {
......@@ -277,6 +280,8 @@ export default class ProfilePage extends React.Component {
<Icon name="edit" />
<Header.Content>Edit Profile Page</Header.Content>
</Header>
<ModalAlert ref={(modal) => { this.modalAlert = modal; }} />
<Form.Field ref={(input) => { this.form = input; }} key={this.state.refresh} size="small" onSubmit={this.handleSubmit}>
<ModalAlert
ref={(modal) => {
this.modalAlert = modal;
......@@ -392,6 +397,9 @@ export default class ProfilePage extends React.Component {
<label htmlFor="portfolio_link">Portfolio Link</label>
<input
onChange={this.handleChange}
placeholder={this.state.portfolio_link === null ? 'https://www.example.com/myproject/' :
this.state.portfolio_link}
defaultValue={this.state.portfolio_link === null ? null : this.state.portfolio_link}
placeholder={
this.state.portfolio_link === null
? 'https://www.example.com/myproject/'
......@@ -562,6 +570,15 @@ export default class ProfilePage extends React.Component {
name="seminar"
/>
</Form.Field>
<Form.Field>
<label htmlFor="interests">Interests</label>
<input
onChange={this.handleChange}
placeholder={this.state.interests === null ? 'Machine Learning' : this.state.interests}
defaultValue={this.state.interests === null ? null : this.state.interests}
name="interests"
/>
</Form.Field>
<Form.Field>
<label htmlFor="resume">Resume</label>
<input
......@@ -666,6 +683,7 @@ export default class ProfilePage extends React.Component {
Submit
</Button>
</Form>
</Form.Field>
</Segment>
);
}
......@@ -1013,6 +1031,21 @@ export default class ProfilePage extends React.Component {
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="lightbulb" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<p>
{' '}
{this.state.interests ||
'Interests belum ditambahkan'}{' '}
</p>
</Grid.Column>
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-11-14 11:52
# Generated by Django 1.11.17 on 2019-11-14 14:00
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='Belum ada kategori perusahaan', max_length=140)),
('website', models.CharField(default='Belum ada link website', max_length=100)),
('category', models.CharField(default=b'Belum ada kategori perusahaan', max_length=140)),
('website', models.CharField(default=b'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='', max_length=100)),
('title', models.CharField(blank=True, default=b'', max_length=100)),
('content', models.TextField()),
],
options={
......@@ -64,16 +64,16 @@ class Migration(migrations.Migration):
('created', models.DateTimeField(auto_now_add=True)),
('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=[django.core.validators.FileExtensionValidator(['pdf'])])),
('resume', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_resume_file_path, validators=[django.core.validators.FileExtensionValidator([b'pdf'])])),
('sertifikat', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_sertifikat_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('^0\\d{1,11}$')])),
('phone_number', models.CharField(blank=True, db_index=True, max_length=100, null=True, validators=[django.core.validators.RegexValidator(b'^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)),
('major', models.CharField(blank=True, max_length=30, null=True)),
('batch', models.CharField(blank=True, max_length=4, null=True)),
('show_transcript', models.BooleanField(default=False)),
('photo', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_photo_file_path, validators=[django.core.validators.FileExtensionValidator(['jpg', 'jpeg', 'png'])])),
('photo', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_photo_file_path, validators=[django.core.validators.FileExtensionValidator([b'jpg', b'jpeg', b'png'])])),
('self_description', models.CharField(blank=True, db_index=True, max_length=500, null=True)),
('portfolio_link', models.URLField(blank=True, null=True)),
('linkedin_url', models.URLField(blank=True, null=True)),
......@@ -91,14 +91,14 @@ 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='student_gpa', default=1.0, null=True)),
('student_gpa', models.FloatField(blank=True, db_column=b'student_gpa', default=1.0, null=True)),
('volunteer', models.CharField(blank=True, max_length=100, null=True)),
('awards', models.CharField(blank=True, max_length=100, null=True)),
('projects', models.CharField(blank=True, max_length=100, null=True)),
('certification', models.CharField(blank=True, max_length=100, null=True)),
('languages', models.CharField(blank=True, max_length=100, null=True)),
('seminar', models.CharField(blank=True, max_length=100, null=True)),
('dependants', models.IntegerField(blank=True, db_column='dependants', default=0, null=True)),
('dependants', models.IntegerField(blank=True, db_column=b'dependants', default=0, null=True)),
],
options={
'ordering': ['-updated'],
......@@ -110,7 +110,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('nip', models.IntegerField(unique=True, validators=[django.core.validators.MinValueValidator(100000000), django.core.validators.MaxValueValidator(9999999999)])),
('nip', models.IntegerField(unique=True, validators=[django.core.validators.MinValueValidator(100000000), django.core.validators.MaxValueValidator(9999999999L)])),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
......@@ -158,7 +158,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='Tidak memenuhi kualifikasi perusahaan.')),
('reason', models.TextField(default=b'Tidak memenuhi kualifikasi perusahaan.')),
],
),
migrations.AddField(
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-11-15 01:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='student',
name='interest',
field=models.CharField(blank=True, max_length=100, null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-11-15 01:55
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0002_student_interest'),
]
operations = [
migrations.RenameField(
model_name='student',
old_name='interest',
new_name='interests',
),
]
......@@ -106,6 +106,7 @@ class Student(models.Model):
certification = models.CharField(max_length=100, blank=True, null=True)
languages = models.CharField(max_length= 100, blank=True, null=True)
seminar = models.CharField(max_length=100, blank=True, null=True)
interests = models.CharField(max_length=100, blank=True, null=True)
dependants = models.IntegerField(db_column='dependants', default=0, blank=True, null=True)
@property
......
......@@ -22,7 +22,7 @@ class StudentSerializer(serializers.ModelSerializer):
fields = ['id', 'name', 'user', 'npm', 'resume', 'phone_number', 'gender', 'birth_place', 'birth_date', 'major', 'batch',
'show_transcript', 'photo', 'accepted_no', 'linkedin_url', 'hackerrank_url', 'region', 'intro', 'portfolio_link', 'website_url', 'student_gpa', 'age', 'recommendations',
'work_experience', 'latest_work', 'latest_work_desc', 'read_no', 'volunteer', 'job_seeking_status', 'skills', 'expected_salary',
'self_description', 'github_url', 'awards', 'certification', 'languages', 'seminar', 'alamat', 'projects', 'dependants']
'self_description', 'github_url', 'awards', 'certification', 'languages', 'seminar', 'interests', 'alamat', 'projects', 'dependants']
def get_accepted_no(self, obj):
apps = Application.objects.filter(student=obj, status=4)
......@@ -75,6 +75,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'certification' : instance.certification,
'languages' : instance.languages,
'seminar' : instance.seminar,
'interests' : instance.interests,
'dependants' : instance.dependants,
}
......@@ -135,6 +136,8 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'languages', instance.languages)
instance.seminar = validated_data.get(
'seminar', instance.seminar)
instance.interests = validated_data.get(
'interests', instance.interests)
instance.dependants = validated_data.get('dependants', instance.dependants)
instance.save()
instance.user.save()
......@@ -144,7 +147,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
model = Student
fields = ['resume', 'email', 'phone_number', 'gender', 'photo', 'show_transcript', 'linkedin_url', 'hackerrank_url', 'region', 'intro', 'portfolio_link', 'website_url', 'student_gpa',
'recommendations', 'work_experience', 'latest_work', 'latest_work_desc', 'volunteer', 'job_seeking_status', 'skills', 'expected_salary',
'self_description', 'github_url', 'awards', 'certification', 'languages', 'seminar', 'alamat', 'projects', 'dependants']
'self_description', 'github_url', 'awards', 'certification', 'languages', 'seminar', 'interests', 'alamat', 'projects', 'dependants']
class CompanyUpdateSerializer(serializers.ModelSerializer):
......
......@@ -237,6 +237,11 @@ class ProfileUpdateTests(APITestCase):
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('seminar'), 'Seminar CompFest')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'interests': 'Machine Learning'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('interests'), 'Machine Learning')
@requests_mock.Mocker()
def test_student_profile_update_filetype_validation(self, m):
mock_csui_oauth_verify(m)
......
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