Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
Kape
Commits
f8ff1f50
Commit
f8ff1f50
authored
Dec 05, 2019
by
Dwi Nanda Susanto
Browse files
Merge branch '1506722720-219' into 'master'
1506722720 219 See merge request
!244
parents
c567f5ad
6a05ed1e
Pipeline
#26732
passed with stages
in 6 minutes and 49 seconds
Changes
6
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
assets/js/EditProfile.jsx
View file @
f8ff1f50
...
...
@@ -78,6 +78,7 @@ export default class EditProfile extends ProfileHandler {
interests
:
''
,
dependants
:
''
,
related_course
:
''
,
ielts
:
1.0
,
};
this
.
getProfile
=
this
.
getProfile
.
bind
(
this
);
this
.
handleChange
=
this
.
handleChange
.
bind
(
this
);
...
...
@@ -120,6 +121,7 @@ export default class EditProfile extends ProfileHandler {
seminar
:
data
.
seminar
,
interests
:
data
.
interests
,
related_course
:
data
.
related_course
,
ielts
:
data
.
ielts
,
});
if
(
this
.
props
.
route
.
own
)
{
const
newSession
=
this
.
props
.
user
.
data
;
...
...
@@ -611,6 +613,23 @@ export default class EditProfile extends ProfileHandler {
type
=
"File"
/>
</
Form
.
Field
>
<
Form
.
Field
>
<
label
htmlFor
=
"ielts"
>
IELTS
</
label
>
<
input
onChange
=
{
this
.
handleChange
}
placeholder
=
{
this
.
state
.
ielts
===
null
?
'
400
'
:
this
.
state
.
ielts
}
defaultValue
=
{
this
.
state
.
ielts
===
null
?
null
:
this
.
state
.
ielts
}
name
=
"ielts"
/>
</
Form
.
Field
>
</
Form
>
</
Segment
>
...
...
assets/js/ProfilePage.jsx
View file @
f8ff1f50
...
...
@@ -102,6 +102,7 @@ export default class ProfilePage extends ProfileHandler {
interests
:
''
,
dependants
:
''
,
related_course
:
''
,
ielts
:
1.0
,
};
this
.
getProfile
=
this
.
getProfile
.
bind
(
this
);
this
.
handleChange
=
this
.
handleChange
.
bind
(
this
);
...
...
@@ -172,6 +173,7 @@ export default class ProfilePage extends ProfileHandler {
interests
:
data
.
interests
,
dependants
:
data
.
dependants
,
related_course
:
data
.
related_course
,
ielts
:
data
.
ielts
,
});
if
(
this
.
props
.
route
.
own
)
{
const
newSession
=
this
.
props
.
user
.
data
;
...
...
@@ -825,6 +827,20 @@ export default class ProfilePage extends ProfileHandler {
</
Grid
.
Column
>
</
Grid
>
</
Segment
>
<
Segment
basic
vertical
>
<
Grid
>
<
Grid
.
Column
width
=
{
2
}
>
<
Icon
name
=
"pencil alternate"
size
=
"big"
/>
</
Grid
.
Column
>
<
Grid
.
Column
width
=
{
13
}
>
<
p
href
=
{
this
.
state
.
ielts
}
>
{
'
'
}
{
this
.
state
.
ielts
||
'
N/A
'
}
{
'
'
}
</
p
>
</
Grid
.
Column
>
</
Grid
>
</
Segment
>
</
Grid
.
Column
>
</
Grid
>
</
Segment
>
...
...
core/migrations/0002_student_ielts.py
0 → 100644
View file @
f8ff1f50
# Generated by Django 2.2.8 on 2019-12-05 15:09
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'student'
,
name
=
'ielts'
,
field
=
models
.
FloatField
(
blank
=
True
,
db_column
=
'ielts'
,
default
=
1.0
,
null
=
True
),
),
]
core/models/accounts.py
View file @
f8ff1f50
...
...
@@ -128,7 +128,8 @@ class Student(models.Model):
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
)
ielts
=
models
.
FloatField
(
db_column
=
'ielts'
,
default
=
1.0
,
blank
=
True
,
null
=
True
)
@
property
def
name
(
self
):
return
get_display_name
(
self
.
user
)
...
...
core/serializers/accounts.py
View file @
f8ff1f50
...
...
@@ -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'
,
'student_toefl_file'
,
'related_course'
]
'interests'
,
'alamat'
,
'projects'
,
'dependants'
,
'student_toefl'
,
'student_toefl_file'
,
'related_course'
,
'ielts'
]
@
staticmethod
def
get_accepted_no
(
obj
):
...
...
@@ -89,6 +89,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'interests'
:
instance
.
interests
,
'dependants'
:
instance
.
dependants
,
'related_course'
:
instance
.
related_course
,
'ielts'
:
instance
.
ielts
,
}
def
update
(
self
,
instance
,
validated_data
):
...
...
@@ -154,6 +155,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
instance
.
dependants
=
validated_data
.
get
(
'dependants'
,
instance
.
dependants
)
instance
.
related_course
=
validated_data
.
get
(
'related_course'
,
instance
.
related_course
)
instance
.
ielts
=
validated_data
.
get
(
'ielts'
,
instance
.
ielts
)
instance
.
save
()
instance
.
user
.
save
()
return
instance
...
...
@@ -165,7 +167,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'
,
'student_toefl_file'
,
'related_course'
]
'interests'
,
'alamat'
,
'projects'
,
'dependants'
,
'student_toefl'
,
'student_toefl_file'
,
'related_course'
,
'ielts'
]
class
CompanyUpdateSerializer
(
serializers
.
ModelSerializer
):
...
...
core/tests/test_accounts.py
View file @
f8ff1f50
...
...
@@ -451,6 +451,16 @@ class ProfileUpdateTests(APITestCase):
response
=
self
.
client
.
patch
(
url
,
{
'dependants'
:
'this is not valid dependants input'
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
url
=
'/api/students/'
+
str
(
student_id
)
+
"/profile/"
response
=
self
.
client
.
patch
(
url
,
{
'ielts'
:
6.0
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_202_ACCEPTED
)
self
.
assertEqual
(
response
.
data
.
get
(
'ielts'
),
6.0
)
url
=
'/api/students/'
+
str
(
student_id
)
+
"/profile/"
response
=
self
.
client
.
patch
(
url
,
{
'ielts'
:
'invalid input'
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
def
_create_test_file
(
self
,
path
):
f
=
open
(
path
,
'rb'
)
return
{
'pdf_file'
:
f
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment