Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 820a2490 authored by Arga Ghulam Ahmad's avatar Arga Ghulam Ahmad
Browse files

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!1991606821601 169
Pipeline #26434 passed
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment