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
16e9a073
Commit
16e9a073
authored
Oct 10, 2019
by
Dwi Nanda Susanto
Browse files
1506722720 - 67 Fitur menambahkan atribut nilai IPK pada halaman profile
parent
b214203b
Changes
9
Hide whitespace changes
Inline
Side-by-side
assets/js/ProfilePage.jsx
View file @
16e9a073
...
...
@@ -51,6 +51,7 @@ export default class ProfilePage extends React.Component {
refresh
:
1
,
loading
:
false
,
linkedin_url
:
''
,
student_gpa
:
0.0
,
website_url
:
''
,
latest_work
:
''
,
latest_work_desc
:
''
,
...
...
@@ -91,6 +92,7 @@ export default class ProfilePage extends React.Component {
intro
:
data
.
intro
,
volunteer
:
data
.
volunteer
,
linkedin_url
:
data
.
linkedin_url
,
student_gpa
:
data
.
student_gpa
,
website_url
:
data
.
website_url
,
latest_work
:
data
.
latest_work
,
latest_work_desc
:
data
.
latest_work_desc
,
...
...
@@ -235,6 +237,11 @@ export default class ProfilePage extends React.Component {
name
=
"show_transcript"
/>
</
Form
.
Field
>
<
Form
.
Field
>
<
label
htmlFor
=
"student_gpa"
>
GPA
</
label
>
<
input
onChange
=
{
this
.
handleChange
}
placeholder
=
"3.50"
name
=
"student_gpa"
/>
</
Form
.
Field
>
<
Button
type
=
"submit"
size
=
"small"
loading
=
{
this
.
state
.
loading
}
primary
floated
=
"right"
>
Submit
</
Button
>
</
Form
>
</
Segment
>
...
...
@@ -318,6 +325,17 @@ export default class ProfilePage extends React.Component {
</
Grid
.
Column
>
</
Grid
>
</
Segment
>
<
Segment
basic
vertical
>
<
Grid
>
<
Grid
.
Column
width
=
{
2
}
>
<
Icon
name
=
"pencil alternate"
size
=
"big"
/>
</
Grid
.
Column
>
<
Grid
.
Column
width
=
{
13
}
>
<
a
href
=
{
this
.
state
.
student_gpa
}
>
{
this
.
state
.
student_gpa
||
'
null
'
}
</
a
>
</
Grid
.
Column
>
</
Grid
>
</
Segment
>
<
Segment
basic
vertical
>
<
Grid
>
...
...
assets/js/__test__/ProfilePage-test.jsx
View file @
16e9a073
...
...
@@ -140,7 +140,7 @@ describe('ProfilePage', () => {
const
profile
=
ReactTestUtils
.
renderIntoDocument
(
<
ProfilePage
route
=
{
{
own
:
true
,
data
:
studentSession
}
}
user
=
{
{
data
:
studentSession
}
}
params
=
{
{
id
:
3
}
}
/>);
const
checkboxNode
=
ReactTestUtils
.
scryRenderedDOMComponentsWithTag
(
profile
,
'
Input
'
)[
6
];
const
checkboxNode
=
ReactTestUtils
.
scryRenderedDOMComponentsWithTag
(
profile
,
'
Input
'
)[
7
];
const
checkbox
=
false
;
checkboxNode
.
value
=
checkbox
;
profile
.
getProfile
().
then
(()
=>
expect
(
profile
.
state
.
show_transcript
).
to
.
equal
(
true
));
...
...
core/migrations/0020_merge_20191006_1635.py
0 → 100644
View file @
16e9a073
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 09:35
from
__future__
import
unicode_literals
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0019_merge_20191006_0852'
),
(
'core'
,
'0017_vacancy_amount'
),
]
operations
=
[
]
core/migrations/0021_auto_20191006_1728.py
0 → 100644
View file @
16e9a073
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 10:28
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0020_merge_20191006_1635'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'student'
,
name
=
'student_gpa'
,
field
=
models
.
FloatField
(
blank
=
True
,
db_column
=
'student_gpa'
,
default
=
1.0
,
null
=
True
),
),
migrations
.
AlterField
(
model_name
=
'company'
,
name
=
'category'
,
field
=
models
.
CharField
(
default
=
'Belum ada kategori perusahaan'
,
max_length
=
140
),
),
migrations
.
AlterField
(
model_name
=
'feedback'
,
name
=
'title'
,
field
=
models
.
CharField
(
blank
=
True
,
default
=
''
,
max_length
=
100
),
),
]
core/migrations/0042_merge_20191010_1317.py
0 → 100644
View file @
16e9a073
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-10 06:17
from
__future__
import
unicode_literals
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0041_merge_20191010_1155'
),
(
'core'
,
'0021_auto_20191006_1728'
),
]
operations
=
[
]
core/migrations/0043_merge_20191010_1827.py
0 → 100644
View file @
16e9a073
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-10 11:27
from
__future__
import
unicode_literals
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0042_merge_20191010_1415'
),
(
'core'
,
'0042_merge_20191010_1317'
),
]
operations
=
[
]
core/models/accounts.py
View file @
16e9a073
...
...
@@ -83,6 +83,7 @@ class Student(models.Model):
latest_work
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
,
null
=
True
)
latest_work_desc
=
models
.
TextField
(
blank
=
True
,
null
=
True
)
intro
=
models
.
CharField
(
max_length
=
50
,
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
)
@
property
...
...
core/serializers/accounts.py
View file @
16e9a073
...
...
@@ -20,7 +20,7 @@ class StudentSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
Student
fields
=
[
'id'
,
'name'
,
'user'
,
'npm'
,
'resume'
,
'phone_number'
,
'birth_place'
,
'birth_date'
,
'major'
,
'batch'
,
\
'show_transcript'
,
'photo'
,
'accepted_no'
,
'linkedin_url'
,
'region'
,
'intro'
,
'website_url'
,
'age'
,
'recommendations'
,
'show_transcript'
,
'photo'
,
'accepted_no'
,
'linkedin_url'
,
'region'
,
'intro'
,
'website_url'
,
'student_gpa'
,
'age'
,
'recommendations'
,
'latest_work'
,
'latest_work_desc'
,
'read_no'
,
'volunteer'
]
def
get_accepted_no
(
self
,
obj
):
...
...
@@ -53,6 +53,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'show_transcript'
:
instance
.
show_transcript
,
'intro'
:
instance
.
intro
,
'website_url'
:
instance
.
website_url
,
'student_gpa'
:
instance
.
student_gpa
,
'volunteer'
:
instance
.
volunteer
,
'linkedin_url'
:
instance
.
linkedin_url
,
'recommendations'
:
instance
.
recommendations
,
...
...
@@ -70,6 +71,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
instance
.
intro
=
validated_data
.
get
(
'intro'
,
instance
.
intro
)
instance
.
volunteer
=
validated_data
.
get
(
'volunteer'
,
instance
.
volunteer
)
instance
.
linkedin_url
=
validated_data
.
get
(
'linkedin_url'
,
instance
.
linkedin_url
)
instance
.
student_gpa
=
validated_data
.
get
(
'student_gpa'
,
instance
.
student_gpa
)
instance
.
website_url
=
validated_data
.
get
(
'website_url'
,
instance
.
website_url
)
instance
.
recommendations
=
validated_data
.
get
(
'recommendations'
,
instance
.
recommendations
)
instance
.
latest_work
=
validated_data
.
get
(
'latest_work'
,
instance
.
latest_work
)
...
...
@@ -80,7 +82,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
Student
fields
=
[
'resume'
,
'email'
,
'phone_number'
,
'photo'
,
'show_transcript'
,
'linkedin_url'
,
'region'
,
'intro'
,
'website_url'
,
fields
=
[
'resume'
,
'email'
,
'phone_number'
,
'photo'
,
'show_transcript'
,
'linkedin_url'
,
'region'
,
'intro'
,
'website_url'
,
'student_gpa'
,
'recommendations'
,
'latest_work'
,
'latest_work_desc'
,
'volunteer'
]
...
...
core/tests/test_accounts.py
View file @
16e9a073
...
...
@@ -223,6 +223,15 @@ 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
,
{
'GPA'
:
1.0
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_202_ACCEPTED
)
self
.
assertEqual
(
response
.
data
.
get
(
'student_gpa'
),
1.0
)
url
=
'/api/students/'
+
str
(
student_id
)
+
"/profile/"
response
=
self
.
client
.
patch
(
url
,
{
'GPA'
:
"this is not a valid input"
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_202_ACCEPTED
)
url
=
'/api/students/'
+
str
(
student_id
)
+
'/profile/'
response
=
self
.
client
.
patch
(
url
,
{
'volunteer'
:
'Ketua BEM UI - 2020'
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_202_ACCEPTED
)
...
...
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