Fakultas Ilmu Komputer UI

Commit 15dde9a0 authored by Farah Alhaniy Efendi's avatar Farah Alhaniy Efendi
Browse files

1606821886 109

parent f112f855
......@@ -54,6 +54,7 @@ export default class ProfilePage extends React.Component {
latest_work: '',
latest_work_desc: '',
github_url: '',
awards: '',
},
bagikanTranskrip: '',
acceptedNo: 0,
......@@ -68,6 +69,7 @@ export default class ProfilePage extends React.Component {
latest_work: '',
latest_work_desc: '',
github_url: '',
awards: '',
};
this.getProfile = this.getProfile.bind(this);
this.handleChange = this.handleChange.bind(this);
......@@ -117,6 +119,7 @@ export default class ProfilePage extends React.Component {
latest_work_desc: data.latest_work_desc,
skills: data.skills,
github_url: data.github_url,
awards: data.awards,
});
if (this.props.route.own) {
const newSession = this.props.user.data;
......@@ -344,6 +347,15 @@ export default class ProfilePage extends React.Component {
name="latest_work_desc"
/>
</Form.Field>
<Form.Field>
<label htmlFor="awards">Awards and Achievements</label>
<input
onChange={this.handleChange}
placeholder={this.state.awards === null ? 'Juara 2 UIUX Gemastik 2019' : this.state.awards}
defaultValue={this.state.awards === null ? null : this.state.awards}
name="awards"
/>
</Form.Field>
<Form.Field>
<label htmlFor="resume">Resume</label>
<input onChange={this.handleFile} placeholder="Resume" name="resume" type="File" />
......@@ -618,6 +630,17 @@ export default class ProfilePage extends React.Component {
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="trophy" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<p> {this.state.awards || 'Awards 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-10-12 17:16
# Generated by Django 1.11.17 on 2019-11-12 06:21
from __future__ import unicode_literals
import core.lib.validators
......@@ -103,7 +103,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={
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-11-12 15:00
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='awards',
field=models.CharField(blank=True, max_length=100, null=True),
),
]
......@@ -100,6 +100,7 @@ class Student(models.Model):
job_seeking_status = models.CharField(max_length=30, blank=True, null=True)
student_gpa = models.FloatField(db_column='student_gpa', default=1.0, blank=True, null=True)
volunteer = models.CharField(max_length=100, blank=True, null=True)
awards = models.CharField(max_length=100, blank=True, null=True)
@property
def name(self):
......
......@@ -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']
'self_description', 'github_url', 'awards']
def get_accepted_no(self, obj):
apps = Application.objects.filter(student=obj, status=4)
......@@ -68,7 +68,8 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'latest_work': instance.latest_work,
'latest_work_desc': instance.latest_work_desc,
'skills': instance.skills,
'github_url': instance.github_url
'github_url': instance.github_url,
'awards' : instance.awards
}
def update(self, instance, validated_data):
......@@ -111,6 +112,8 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'latest_work_desc', instance.latest_work_desc)
instance.github_url = validated_data.get(
'github_url', instance.github_url)
instance.awards = validated_data.get(
'awards', instance.awards)
instance.save()
instance.user.save()
return instance
......@@ -119,7 +122,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']
'self_description', 'github_url', 'awards']
class CompanyUpdateSerializer(serializers.ModelSerializer):
......
......@@ -245,6 +245,11 @@ class ProfileUpdateTests(APITestCase):
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('intro'), 'Saya tertarik dengan dunia front-end development')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'awards': 'Juara 2 UIUX Gemastik 2019'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('awards'), 'Juara 2 UIUX Gemastik 2019')
@requests_mock.Mocker()
def test_student_profile_update_filetype_validation(self, m):
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)
......
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