Fakultas Ilmu Komputer UI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kape
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PMPL
Class Project
Kape
Commits
820a2490
Commit
820a2490
authored
5 years ago
by
Arga Ghulam Ahmad
Browse files
Options
Downloads
Patches
Plain Diff
Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed
parent
64f81625
No related branches found
No related tags found
1 merge request
!199
1606821601 169
Pipeline
#26434
passed
5 years ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/views/accounts/student.py
+9
-6
9 additions, 6 deletions
core/views/accounts/student.py
with
9 additions
and
6 deletions
core/views/accounts/student.py
+
9
−
6
View file @
820a2490
...
...
@@ -59,18 +59,21 @@ class StudentViewSet(viewsets.ModelViewSet):
if
'
linkedin_url
'
in
request
.
data
.
keys
():
if
not
re
.
search
(
linkedin_url_pattern
,
request
.
data
[
'
linkedin_url
'
]):
return
Response
({
'
Error
'
:
"
Pastikan link linkedin yang anda tulis benar. (Berpola :
"
"
https://linkedin.com/in/<username>
"
},
status
=
status
.
HTTP_400_BAD_REQUEST
)
'
Error
'
:
"
Pastikan link linkedin yang anda tulis benar. (Berpola :
"
"
https://linkedin.com/in/<username>
"
},
status
=
status
.
HTTP_400_BAD_REQUEST
)
if
'
hackerrank_url
'
in
request
.
data
.
keys
():
if
not
re
.
search
(
hackerrank_url_pattern
,
request
.
data
[
'
hackerrank_url
'
]):
return
Response
({
'
Error
'
:
"
Pastikan link hackerrank yang anda tulis benar. (Berpola :
"
"
https://hackerrank.com/<username>
"
},
status
=
status
.
HTTP_400_BAD_REQUEST
)
'
Error
'
:
"
Pastikan link hackerrank yang anda tulis benar. (Berpola :
"
"
https://hackerrank.com/<username>
"
},
status
=
status
.
HTTP_400_BAD_REQUEST
)
return
self
.
profile_serialize
(
request
,
user
)
def
profile_serialize
(
self
,
request
,
user
):
serializer
=
self
.
serializer_class
(
user
,
data
=
request
.
data
,
partial
=
True
)
if
serializer
.
is_valid
():
if
serializer
.
validated_data
.
get
(
'
skills
'
)
is
not
None
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment