Fakultas Ilmu Komputer UI

Commit 1959a89c authored by Farah Alhaniy Efendi's avatar Farah Alhaniy Efendi
Browse files

Merge branch '1606821886-193' into 'master'

1606821886 193

See merge request !224
parents aa245800 8f7eeb4d
Pipeline #26594 passed with stages
in 23 minutes and 28 seconds
......@@ -58,6 +58,7 @@ export default class EditProfile extends React.Component {
languages: '',
seminar: '',
interests: '',
related_course: '',
},
refresh: 1,
loading: false,
......@@ -76,6 +77,7 @@ export default class EditProfile extends React.Component {
seminar: '',
interests: '',
dependants: '',
related_course: '',
};
this.getProfile = this.getProfile.bind(this);
this.handleChange = this.handleChange.bind(this);
......@@ -117,6 +119,7 @@ export default class EditProfile extends React.Component {
languages: data.languages,
seminar: data.seminar,
interests: data.interests,
related_course: data.related_course,
});
if (this.props.route.own) {
const newSession = this.props.user.data;
......@@ -543,6 +546,22 @@ export default class EditProfile extends React.Component {
/>
</Form.Field>
<Form.Field>
<label htmlFor="related_course">Related Coursework Taken</label>
<input
onChange={this.handleChange}
placeholder={
this.state.related_course === null
? 'Intraction System, Machine Learning'
: this.state.related_course
}
defaultValue={
this.state.related_course === null ? null : this.state.related_course
}
name="related_course"
/>
</Form.Field>
<Form.Field>
<label htmlFor="resume">Resume</label>
<input
......
......@@ -76,6 +76,7 @@ export default class ProfilePage extends React.Component {
languages: '',
seminar: '',
interests: '',
related_course: '',
},
bagikanTranskrip: '',
acceptedNo: 0,
......@@ -100,6 +101,7 @@ export default class ProfilePage extends React.Component {
semimar: '',
interests: '',
dependants: '',
related_course: '',
};
this.getProfile = this.getProfile.bind(this);
this.handleChange = this.handleChange.bind(this);
......@@ -167,6 +169,7 @@ export default class ProfilePage extends React.Component {
seminar: data.seminar,
interests: data.interests,
dependants: data.dependants,
related_course: data.related_course,
});
if (this.props.route.own) {
const newSession = this.props.user.data;
......@@ -616,6 +619,21 @@ export default class ProfilePage extends React.Component {
name="interests"
/>
</Form.Field>
<Form.Field>
<label htmlFor="related_course">Related Coursework Taken</label>
<input
onChange={this.handleChange}
placeholder={
this.state.related_course === null
? 'Interaction System, Machine Learning'
: this.state.related_course
}
defaultValue={
this.state.related_course === null ? null : this.state.related_course
}
name="related_course"
/>
</Form.Field>
<Form.Field>
<label htmlFor="resume">Resume</label>
<input
......@@ -1220,6 +1238,20 @@ export default class ProfilePage extends React.Component {
</Grid.Column>
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="book" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<p>
{' '}
{this.state.related_course || 'Related Course 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-12-03 19:28
# Generated by Django 1.11.17 on 2019-12-04 03:48
from __future__ import unicode_literals
import core.lib.validators
......@@ -116,6 +116,7 @@ class Migration(migrations.Migration):
('seminar', models.CharField(blank=True, max_length=100, null=True)),
('interests', models.CharField(blank=True, max_length=100, null=True)),
('dependants', models.IntegerField(blank=True, db_column=b'dependants', default=0, null=True)),
('related_course', models.CharField(blank=True, max_length=200, null=True)),
],
options={
'ordering': ['-updated'],
......@@ -127,7 +128,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={
......
......@@ -120,6 +120,7 @@ class Student(models.Model):
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)
related_course = models.CharField(max_length=200, blank=True, null=True)
@property
def name(self):
......
......@@ -26,7 +26,7 @@ class StudentSerializer(serializers.ModelSerializer):
'work_experience', 'latest_work', 'latest_work_desc', 'read_no', 'volunteer', 'job_seeking_status',
'skills', 'expected_salary',
'self_description', 'github_url', 'gitlab_url', 'awards', 'certification', 'languages', 'seminar',
'interests', 'alamat', 'projects', 'dependants', 'student_toefl']
'interests', 'alamat', 'projects', 'dependants', 'student_toefl', 'related_course']
@staticmethod
def get_accepted_no(obj):
......@@ -84,6 +84,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'seminar': instance.seminar,
'interests': instance.interests,
'dependants': instance.dependants,
'related_course':instance.related_course,
}
def update(self, instance, validated_data):
......@@ -146,6 +147,8 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
instance.interests = validated_data.get(
'interests', instance.interests)
instance.dependants = validated_data.get('dependants', instance.dependants)
instance.related_course = validated_data.get(
'related_course', instance.related_course)
instance.save()
instance.user.save()
return instance
......@@ -157,7 +160,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'work_experience', 'latest_work', 'latest_work_desc', 'volunteer', 'job_seeking_status', 'skills',
'expected_salary',
'self_description', 'github_url', 'gitlab_url', 'awards', 'certification', 'languages', 'seminar',
'interests', 'alamat', 'projects', 'dependants', 'student_toefl']
'interests', 'alamat', 'projects', 'dependants', 'student_toefl', 'related_course']
class CompanyUpdateSerializer(serializers.ModelSerializer):
......
......@@ -348,6 +348,16 @@ class ProfileUpdateTests(APITestCase):
response = self.client.patch(url, {'skills': '1231231231'}, format='multipart', encoding='utf-8')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'related_course': 'Interaction System, Machine Learning'}, format='multipart',
encoding='utf-8')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('related_course'), 'Interaction System, Machine Learning')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'related_course': failing_desc}, format='multipart', encoding='utf-8')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
@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