From 9d0e2faaacd9ff37809b37680b455f621e9fe1b2 Mon Sep 17 00:00:00 2001
From: Fannyah Dita Cahya <fannyah.dita@ui.ac.id>
Date: Thu, 14 Nov 2019 14:50:47 +0700
Subject: [PATCH] 1606918414 122

---
 assets/js/EditProfile.jsx       | 12 ++++++++++++
 assets/js/ProfilePage.jsx       | 22 ++++++++++++++++++++++
 core/migrations/0001_initial.py |  5 +++--
 core/models/accounts.py         |  1 +
 core/serializers/accounts.py    |  7 +++++--
 core/tests/test_accounts.py     |  5 +++++
 6 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/assets/js/EditProfile.jsx b/assets/js/EditProfile.jsx
index ffe919f2..36984b27 100644
--- a/assets/js/EditProfile.jsx
+++ b/assets/js/EditProfile.jsx
@@ -55,6 +55,7 @@ export default class ProfilePage extends React.Component {
         latest_work_desc: '',
         github_url: '',
         awards: '',
+        certification: '',
         languages: '',
         seminar: '',
       },
@@ -72,6 +73,7 @@ export default class ProfilePage extends React.Component {
       latest_work_desc: '',
       github_url: '',
       awards: '',
+      certification: '',
       languages: '',
       seminar: '',
     };
@@ -124,6 +126,7 @@ export default class ProfilePage extends React.Component {
         skills: data.skills,
         github_url: data.github_url,
         awards: data.awards,
+        certification: data.certification,
         languages: data.languages,
         seminar: data.seminar,
       });
@@ -362,6 +365,15 @@ export default class ProfilePage extends React.Component {
                 name="awards"
               />
             </Form.Field>
+            <Form.Field>
+              <label htmlFor="certification">Sertifikasi</label>
+              <input
+                onChange={this.handleChange}
+                placeholder={this.state.certification === null ? 'TOEFL' : this.state.certification}
+                defaultValue={this.state.certification === null ? null : this.state.certification}
+                name="certification"
+              />
+            </Form.Field>
             <Form.Field>
               <label htmlFor="languages">Bahasa yang dikuasai</label>
               <input
diff --git a/assets/js/ProfilePage.jsx b/assets/js/ProfilePage.jsx
index 94d0f070..f18e72d8 100755
--- a/assets/js/ProfilePage.jsx
+++ b/assets/js/ProfilePage.jsx
@@ -55,6 +55,7 @@ export default class ProfilePage extends React.Component {
         latest_work_desc: '',
         github_url: '',
         awards: '',
+        certification: '',
         languages: '',
         seminar: '',
       },
@@ -72,6 +73,7 @@ export default class ProfilePage extends React.Component {
       latest_work_desc: '',
       github_url: '',
       awards: '',
+      certification: '',
       languages: '',
       semimar: '',
     };
@@ -124,6 +126,7 @@ export default class ProfilePage extends React.Component {
         skills: data.skills,
         github_url: data.github_url,
         awards: data.awards,
+        certification: data.certification,
         languages: data.languages,
         seminar: data.seminar,
       });
@@ -362,6 +365,14 @@ export default class ProfilePage extends React.Component {
                 name="awards"
               />
             </Form.Field>
+            <Form.Field>
+              <label htmlFor="certification">Sertifikasi</label>
+              <input
+                onChange={this.handleChange}
+                placeholder={this.state.certification === null ? 'TOEFL' : this.state.certification}
+                defaultValue={this.state.certification === null ? null : this.state.certification}
+                name="certification"/>
+            </Form.Field>
             <Form.Field>
               <label htmlFor="seminar">Seminar dan Training</label>
               <input
@@ -656,6 +667,17 @@ export default class ProfilePage extends React.Component {
                     </Grid>
                   </Segment>
 
+                  <Segment basic vertical>
+                    <Grid>
+                      <Grid.Column width={2}>
+                        <Icon name="certificate" size="big" />
+                      </Grid.Column>
+                      <Grid.Column width={13}>
+                        <p> {this.state.certification|| 'N/A'} </p>
+                      </Grid.Column>
+                    </Grid>
+                  </Segment>
+
                   <Segment basic vertical>
                     <Grid>
                       <Grid.Column width={2}>
diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py
index af286b7a..d4b6fb10 100644
--- a/core/migrations/0001_initial.py
+++ b/core/migrations/0001_initial.py
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Generated by Django 1.11.17 on 2019-11-14 06:42
+# Generated by Django 1.11.17 on 2019-11-14 07:37
 from __future__ import unicode_literals
 
 import core.lib.validators
@@ -93,6 +93,7 @@ class Migration(migrations.Migration):
                 ('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)),
+                ('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)),
             ],
@@ -106,7 +107,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={
diff --git a/core/models/accounts.py b/core/models/accounts.py
index def449b4..e588e21e 100755
--- a/core/models/accounts.py
+++ b/core/models/accounts.py
@@ -101,6 +101,7 @@ class Student(models.Model):
     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)
+    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)
 
diff --git a/core/serializers/accounts.py b/core/serializers/accounts.py
index d0efacf9..58fa12c6 100755
--- a/core/serializers/accounts.py
+++ b/core/serializers/accounts.py
@@ -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', 'languages', 'seminar']
+                  'self_description', 'github_url', 'awards', 'certification', 'languages', 'seminar']
 
     def get_accepted_no(self, obj):
         apps = Application.objects.filter(student=obj, status=4)
@@ -70,6 +70,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
             'skills': instance.skills,
             'github_url': instance.github_url,
             'awards' : instance.awards,
+            'certification' : instance.certification,
             'languages' : instance.languages,
             'seminar' : instance.seminar
         }
@@ -116,6 +117,8 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
             'github_url', instance.github_url)
         instance.awards = validated_data.get(
             'awards', instance.awards)
+        instance.certification = validated_data.get(
+            'certification', instance.certification)
         instance.languages = validated_data.get(
             'languages', instance.languages)
         instance.seminar = validated_data.get(
@@ -128,7 +131,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', 'languages', 'seminar']
+                  'self_description', 'github_url', 'awards', 'certification', 'languages', 'seminar']
 
 
 class CompanyUpdateSerializer(serializers.ModelSerializer):
diff --git a/core/tests/test_accounts.py b/core/tests/test_accounts.py
index 480ac0b3..e9fd65d8 100755
--- a/core/tests/test_accounts.py
+++ b/core/tests/test_accounts.py
@@ -213,6 +213,11 @@ class ProfileUpdateTests(APITestCase):
         self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
         self.assertEqual(response.data.get('awards'), 'Juara 2 UIUX Gemastik 2019')
 
+        url = '/api/students/' + str(student_id) + "/profile/"
+        response = self.client.patch(url, {'certification': 'TOEFL'}, format='multipart')
+        self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
+        self.assertEqual(response.data.get('certification'), 'TOEFL')
+        
         url = '/api/students/' + str(student_id) + "/profile/"
         response = self.client.patch(url, {'languages': 'Indonesia, Inggris'}, format='multipart')
         self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
-- 
GitLab