Fakultas Ilmu Komputer UI

Commit 4a4ca6f5 authored by MISAEL JONATHAN's avatar MISAEL JONATHAN
Browse files

Merge branch '1606879773-218' into 'master'

1606879773 218

See merge request !287
parents 4d637521 9042c59e
Pipeline #26871 passed with stages
in 48 minutes and 36 seconds
......@@ -32,6 +32,8 @@ export default class EditProfile extends ProfileHandler {
phone_number: '',
portfolio_link: '',
show_transcript: '',
expected_salary: '',
self_description: '',
intro: '',
skills: '',
form: {
......@@ -100,11 +102,13 @@ export default class EditProfile extends ProfileHandler {
id: data.id,
name: data.full_name,
email: data.user.email,
self_description: data.self_description,
region: data.region,
alamat: data.alamat,
phone_number: data.phone_number,
portfolio_link: data.portfolio_link,
show_transcript: data.show_transcript,
expected_salary: data.expected_salary,
refresh: this.state.refresh + 1,
intro: data.intro,
linkedin_url: data.linkedin_url,
......@@ -124,6 +128,7 @@ export default class EditProfile extends ProfileHandler {
seminar: data.seminar,
interests: data.interests,
related_course: data.related_course,
volunteer: data.volunteer,
ielts: data.ielts,
});
if (this.props.route.own) {
......@@ -238,6 +243,217 @@ export default class EditProfile extends ProfileHandler {
onClick={this.handleRadioGender}
/>
</Form.Field>
<Form.Field>
<label htmlFor="self_description">Deskripsi Diri</label>
<input
onChange={this.handleChange}
placeholder="Saya suka belajar"
defaultValue= {
this.state.self_description === null ? null : this.state.self_description
}
name="self_description"
/>
</Form.Field>
<Form.Field>
<label htmlFor="region">Region</label>
<input
onChange={this.handleChange}
placeholder={
this.state.region === null ? 'Indonesia' : this.state.region
}
defaultValue={
this.state.region === null ? null : this.state.region
}
name="region"
/>
</Form.Field>
<Form.Field>
<label htmlFor="alamat">Alamat</label>
<input
onChange={this.handleChange}
placeholder={
this.state.alamat === null
? 'JL. Satya Raya No.41'
: this.state.alamat
}
defaultValue={
this.state.alamat === null ? null : this.state.alamat
}
name="alamat"
/>
</Form.Field>
<Form.Field>
<label htmlFor="skills">Skills</label>
<input
onChange={this.handleChange}
placeholder="Isi sesuai dengan keahlian anda"
defaultValue={this.state.skills === null ? null : this.state.skills}
name="skills"
/>
</Form.Field>
<Form.Field>
<label htmlFor="languages">Bahasa yang dikuasai</label>
<input
onChange={this.handleChange}
placeholder="Indonesia, Jerman (pisahkan dengan koma)"
defaultValue={
this.state.languages === null ? null : this.state.languages
}
name="languages"
/>
</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="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
onChange={this.handleFile}
placeholder="Resume"
name="resume"
type="File"
/>
</Form.Field>
<Form.Field>
<label htmlFor="expected_salary">Expected Salary</label>
<input
onChange={this.handleChange}
placeholder="2000000"
defaultValue = {
this.state.expected_salary === null ? null : this.state.expected_salary
}
name="expected_salary"
/>
</Form.Field>
<Form.Field>
<label htmlFor="intro">Intro</label>
<input
onChange={this.handleChange}
placeholder={
this.state.intro === null
? 'Ceritakan dirimu secara singkat'
: this.state.intro
}
defaultValue={
this.state.intro === null ? null : this.state.intro
}
name="intro"
/>
</Form.Field>
<Form.Field>
<label htmlFor="intro">Status Pencarian Kerja</label>
<Form.Radio
label="Aktif"
name="job_seeking_status"
value="Active"
onClick={this.handleRadio}
/>
<Form.Radio
label="Pasif"
name="job_seeking_status"
value="Passive"
onClick={this.handleRadio}
/>
</Form.Field>
<Form.Field>
<Checkbox
onChange={this.handleCheckbox}
checked={!!this.state.show_transcript}
label="Ijinkan perusahaan tempat saya mendaftar untuk melihat transkrip akademik saya"
name="show_transcript"
/>
</Form.Field>
<Form.Field>
<label htmlFor="student_gpa">GPA</label>
<input
onChange={this.handleChange}
placeholder={
this.state.student_gpa === null
? '3.50'
: this.state.student_gpa
}
defaultValue={
this.state.student_gpa === null
? null
: this.state.student_gpa
}
name="student_gpa"
/>
</Form.Field>
<Form.Field>
<label htmlFor="student_toefl">TOEFL</label>
<input
onChange={this.handleChange}
placeholder={
this.state.email === null
? 'jojon@email.com'
: this.state.email
}
defaultValue={
this.state.email === null ? null : this.state.email
}
name="email"
/>
</Form.Field>
<Form.Field>
<label htmlFor="phone_number">No. Hp</label>
<input
onChange={this.handleChange}
placeholder={
this.state.phone_number === null
? '08123456789'
: this.state.phone_number
}
defaultValue={
this.state.phone_number === null
? null
: this.state.phone_number
}
name="phone_number"
/>
</Form.Field>
<Form.Field>
<label htmlFor="gender">Jenis Kelamin</label>
<Form.Radio
label="Perempuan"
name="gender"
value="Perempuan"
onClick={this.handleRadioGender}
/>
<Form.Radio
label="Laki-laki"
name="gender"
value="Laki-laki"
onClick={this.handleRadioGender}
/>
</Form.Field>
<Form.Field>
<label htmlFor="self_description">Deskripsi Diri</label>
<input
......@@ -464,6 +680,19 @@ export default class EditProfile extends ProfileHandler {
name="projects"
/>
</Form.Field>
<Form.Field>
<label htmlFor="volunteer">Volunteering Experience</label>
<input
onChange={this.handleChange}
placeholder="Ketua Organisasi A - 2020"
name="volunteer"
defaultValue={
this.state.volunteer === null ? null :this.state.volunteer
}
/>
</Form.Field>
<Form.Field>
<label htmlFor="certification">Sertifikasi</label>
<input
......
......@@ -36,7 +36,6 @@ export default class NotificationPage extends React.Component {
}
console.log('Notifikasi');
Storage.set('menu-active-state', 'Notifikasi');
}
......@@ -51,8 +50,6 @@ export default class NotificationPage extends React.Component {
onClickDismiss = (index) => {
var array = [...this.state.list];
array.splice(index, 1);
console.log("eh kepencet")
console.log(index)
this.setState({
list : array
......
......@@ -115,8 +115,6 @@ export default class ProfilePage extends ProfileHandler {
this.gotoStudentToeflFile = this.gotoStudentToeflFile.bind(this);
this.getProfile();
console.log('profil');
Storage.set('menu-active-state', 'Profil');
}
......
export const isFromGithubLinkValid = github_link => {
if (github_link == null) return;
return github_link.includes('https://github.com/');
return (github_link.includes('https://github.com/') || github_link.length === 0);
};
export const gotoLink = url => window.open(url).focus();
......@@ -53,7 +53,6 @@ export default class Pagination extends React.Component {
false,
).then(
(data) => {
console.log('GET ITEM DATA');
this.setState({
current: this.state.current + this.state.dir,
});
......
......@@ -176,8 +176,6 @@ export default class VacancyList extends React.Component {
salary={this.props.salary}
/>
));
console.log(vacancies);
console.log("ini cuy")
vacancies = this.sortVacancies(vacancies);
vacancies = this.filterVacanciesBasedOnSalary(vacancies);
vacancies = this.filterVacanciesBasedOnVacancyStatus(vacancies);
......
import math
import os
import re
from django.core.exceptions import ValidationError
......@@ -27,6 +28,10 @@ def validate_student_gpa(value):
if value < 0 or value > 4:
raise ValidationError(u"GPA harus merupakan angka antara 0-4")
def validate_languages_contains_string_type_value(value):
if not re.search("^[a-zA-Z ,]*$", value):
raise ValidationError(u"Bahasa hanya mengandung karakter alphabet")
def validate_toefl_score(value):
if value < 0 or value >677:
raise ValidationError(u"skor toefl harus merupakan angka antara 0-677")
......
# Generated by Django 2.2.8 on 2019-12-06 12:07
# Generated by Django 2.2.8 on 2019-12-06 15:30
import core.lib.validators
import core.models.accounts
......@@ -139,7 +139,7 @@ class Migration(migrations.Migration):
('hackerrank_url', models.URLField(blank=True, null=True)),
('website_url', models.URLField(blank=True, null=True)),
('work_experience', models.CharField(blank=True, max_length=500, null=True)),
('region', models.CharField(blank=True, max_length=30, null=True)),
('region', models.CharField(blank=True, max_length=30, null=True, validators=[django.core.validators.RegexValidator('^[A-Za-z]+$')])),
('alamat', models.CharField(blank=True, max_length=50, null=True)),
('skills', models.CharField(blank=True, max_length=50, null=True)),
('ui_ux_portofolio', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_ui_ux_portofolio_file_path, validators=[core.lib.validators.validate_document_file_extension])),
......@@ -157,7 +157,7 @@ class Migration(migrations.Migration):
('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)),
('languages', models.CharField(blank=True, max_length=100, null=True, validators=[core.lib.validators.validate_languages_contains_string_type_value])),
('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='dependants', default=0, null=True)),
......
# Generated by Django 2.2.8 on 2019-12-06 08:57
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='student',
name='region',
field=models.CharField(blank=True, max_length=30, null=True, validators=[django.core.validators.RegexValidator('^\\w{0,30}$')]),
),
]
# Generated by Django 2.2.8 on 2019-12-06 09:00
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20191206_1557'),
]
operations = [
migrations.AlterField(
model_name='student',
name='region',
field=models.CharField(blank=True, max_length=30, null=True, validators=[django.core.validators.RegexValidator('^[A-Za-z]+$')]),
),
]
......@@ -7,7 +7,7 @@ from django.core.validators import MinValueValidator, MaxValueValidator, RegexVa
from django.db import models
from core.lib.validators import validate_document_file_extension, validate_image_file_extension, validate_npm, \
validate_student_gpa, validate_toefl_score
validate_student_gpa, validate_languages_contains_string_type_value, validate_toefl_score
def get_student_resume_file_path(instance, filename):
......@@ -123,7 +123,7 @@ class Student(models.Model):
awards = models.CharField(max_length=100, blank=True, null=True)
projects = 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)
languages = models.CharField(max_length=100, blank=True, null=True, validators=[validate_languages_contains_string_type_value])
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)
......
......@@ -5,6 +5,7 @@ from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from rest_framework import status
from rest_framework.test import APITestCase
from rest_framework.exceptions import ErrorDetail
from django.core import serializers
from core.models.accounts import Student
......@@ -139,13 +140,18 @@ class ProfileUpdateTests(APITestCase):
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('self_description'), 'I am very happy')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'languages': 'Indonesia, Jerman'}, format='multipart', encoding='utf-8')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('languages'), 'Indonesia, Jerman')
response = self.client.patch(url, {'languages': '123456'}, format='multipart', encoding='utf-8')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
response = self.client.patch(url, {'linkedin_url': 'https://www.linkedin.com/in/jojo/'}, format='multipart',
encoding='utf-8')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('linkedin_url'), 'https://www.linkedin.com/in/jojo/')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'linkedin_url': 'https://linkedin.com/in/jojo/'}, format='multipart',
encoding='utf-8')
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