Fakultas Ilmu Komputer UI

Commit 8961e3aa authored by Tyagita Larasati's avatar Tyagita Larasati
Browse files

1606918616 119

parent 077e20fd
......@@ -55,6 +55,7 @@ export default class ProfilePage extends React.Component {
latest_work_desc: '',
github_url: '',
awards: '',
languages: '',
seminar: '',
},
bagikanTranskrip: '',
......@@ -71,6 +72,7 @@ export default class ProfilePage extends React.Component {
latest_work_desc: '',
github_url: '',
awards: '',
languages: '',
seminar: '',
};
this.getProfile = this.getProfile.bind(this);
......@@ -122,6 +124,7 @@ export default class ProfilePage extends React.Component {
skills: data.skills,
github_url: data.github_url,
awards: data.awards,
languages: data.languages,
seminar: data.seminar,
});
if (this.props.route.own) {
......@@ -134,12 +137,12 @@ export default class ProfilePage extends React.Component {
this.state.name = 'Gagal mendapatkan informasi';
}));
}
isFromGithubLinkValid = () => {
var github_link = this.state.form.github_url;
if (github_link == null) return;
return github_link.includes("https://github.com/");
}
}
parseIndonesianDateFormat(dateIndex) {
const monthNameIndex = {
......@@ -204,7 +207,7 @@ export default class ProfilePage extends React.Component {
this.setState({ form, show_transcript: d.checked });
};
handleRadioGender = (e, {value}) => {
handleRadioGender = (e, { value }) => {
const form = this.state.form;
form.gender = value;
this.setState({ form })
......@@ -225,7 +228,7 @@ export default class ProfilePage extends React.Component {
gotoStudentTranscript = () => this.gotoLink(`transkrip/${this.state.id}`);
updateForm(show){
updateForm(show) {
if (show) {
return (
<Segment className="profile-form">
......@@ -301,7 +304,7 @@ export default class ProfilePage extends React.Component {
<input
onChange={this.handleChange}
placeholder={this.state.portfolio_link === null ? 'https://www.example.com/myproject/' :
this.state.portfolio_link}
this.state.portfolio_link}
defaultValue={this.state.portfolio_link === null ? null : this.state.portfolio_link}
name="portfolio_link"
/>
......@@ -330,7 +333,7 @@ export default class ProfilePage extends React.Component {
</Form.Field>
<Form.Field>
<label htmlFor="skills">Skills</label>
<input onChange={this.handleChange} placeholder="Isi sesuai dengan keahlian anda" name="skills"/>
<input onChange={this.handleChange} placeholder="Isi sesuai dengan keahlian anda" name="skills" />
</Form.Field>
<Form.Field>
<label htmlFor="latest_work">Latest Working Experience</label>
......@@ -359,6 +362,15 @@ export default class ProfilePage extends React.Component {
name="awards"
/>
</Form.Field>
<Form.Field>
<label htmlFor="languages">Bahasa yang dikuasai</label>
<input
onChange={this.handleChange}
placeholder={this.state.languages === null ? 'Indonesia' : this.state.languages}
defaultValue={this.state.languages === null ? null : this.state.languages}
name="languages" />
</Form.Field>
<Form.Field>
<label htmlFor="seminar">Seminar dan Training</label>
<input
......@@ -368,6 +380,7 @@ export default class ProfilePage extends React.Component {
name="seminar"
/>
</Form.Field>
<Form.Field>
<label htmlFor="resume">Resume</label>
<input onChange={this.handleFile} placeholder="Resume" name="resume" type="File" />
......@@ -434,7 +447,7 @@ export default class ProfilePage extends React.Component {
render() {
return (
<div className="profilePage">
{ this.updateForm(this.props.route.own) }
{this.updateForm(this.props.route.own)}
</div>
);
}
......
......@@ -55,6 +55,7 @@ export default class ProfilePage extends React.Component {
latest_work_desc: '',
github_url: '',
awards: '',
languages: '',
seminar: '',
},
bagikanTranskrip: '',
......@@ -71,6 +72,7 @@ export default class ProfilePage extends React.Component {
latest_work_desc: '',
github_url: '',
awards: '',
languages: '',
semimar: '',
};
this.getProfile = this.getProfile.bind(this);
......@@ -122,6 +124,7 @@ export default class ProfilePage extends React.Component {
skills: data.skills,
github_url: data.github_url,
awards: data.awards,
languages: data.languages,
seminar: data.seminar,
});
if (this.props.route.own) {
......@@ -653,6 +656,17 @@ export default class ProfilePage extends React.Component {
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="comment" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<p> {this.state.languages|| 'N/A'} </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 05:40
# Generated by Django 1.11.17 on 2019-11-14 06:42
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)),
......@@ -90,9 +90,10 @@ 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)),
('languages', models.CharField(blank=True, max_length=100, null=True)),
('seminar', models.CharField(blank=True, max_length=100, null=True)),
],
options={
......@@ -152,7 +153,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(
......
......@@ -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)
languages = models.CharField(max_length= 100, blank=True, null=True)
seminar = models.CharField(max_length=100, 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', 'seminar']
'self_description', 'github_url', 'awards', '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,
'languages' : instance.languages,
'seminar' : instance.seminar
}
......@@ -115,6 +116,8 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'github_url', instance.github_url)
instance.awards = validated_data.get(
'awards', instance.awards)
instance.languages = validated_data.get(
'languages', instance.languages)
instance.seminar = validated_data.get(
'seminar', instance.seminar)
instance.save()
......@@ -125,7 +128,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', 'seminar']
'self_description', 'github_url', 'awards', 'languages', 'seminar']
class CompanyUpdateSerializer(serializers.ModelSerializer):
......
......@@ -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, {'languages': 'Indonesia, Inggris'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('languages'), 'Indonesia, Inggris')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'seminar': 'Seminar CompFest'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
......
This diff is collapsed.
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