Skip to content

Commit 77c3096

Browse files
Akshat453Akshat SinghRishabhJain2018
authored
Code Quality: Fix pylint warnings for analytics app(#4558)
* Pylint Score increased for apps/analytics/serializers.py * Pylint Score increased for apps/analytics/views.py * Pylint Score increased for apps/analytics/urls.py * Conflicts Resolved * Revert "Conflicts Resolved" This reverts commit c8f533c. * Conflicts Resolved * Conflicts Resolved * Conflicts Resolved * Conflicts Resolved * Conflicts Resolved * Fixed Build * Resolved Conflict * Removed Unnecessary Changes * Black Fix * Black Fix * Black Fix * Made Changes --------- Co-authored-by: Akshat Singh <[email protected]> Co-authored-by: Rishabh Jain <[email protected]>
1 parent c504393 commit 77c3096

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

apps/analytics/serializers.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from rest_framework import serializers
22

33

4-
class ChallengePhaseSubmissionAnalytics(object):
4+
class ChallengePhaseSubmissionAnalytics:
5+
# pylint: disable=too-many-arguments
56
def __init__(
67
self,
78
total_submissions,
@@ -25,7 +26,7 @@ class ChallengePhaseSubmissionAnalyticsSerializer(serializers.Serializer):
2526
challenge_phase = serializers.IntegerField()
2627

2728

28-
class ChallengePhaseSubmissionCount(object):
29+
class ChallengePhaseSubmissionCount:
2930
def __init__(self, participant_team_submission_count, challenge_phase_pk):
3031
self.participant_team_submission_count = (
3132
participant_team_submission_count
@@ -38,7 +39,7 @@ class ChallengePhaseSubmissionCountSerializer(serializers.Serializer):
3839
challenge_phase = serializers.IntegerField()
3940

4041

41-
class LastSubmissionTimestamp(object):
42+
class LastSubmissionTimestamp:
4243
def __init__(
4344
self,
4445
last_submission_timestamp_in_challenge,

apps/analytics/urls.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
from django.conf.urls import url
1+
from django.urls import re_path
22

33
from . import views
44

55
urlpatterns = [
6-
url(
6+
re_path(
77
r"^challenge/(?P<challenge_pk>[0-9]+)/team/count$",
88
views.get_participant_team_count,
99
name="get_participant_team_count",
1010
),
11-
url(
11+
re_path(
1212
r"^challenge/(?P<challenge_pk>[0-9]+)/participant/count$",
1313
views.get_participant_count,
1414
name="get_participant_count",
1515
),
16-
url(
16+
re_path(
1717
r"^challenge/(?P<challenge_pk>[0-9]+)/submission/(?P<duration>[A-Za-z]+)/count$",
1818
views.get_submission_count,
1919
name="get_submission_count",
2020
),
21-
url(
21+
re_path(
2222
r"^challenge/(?P<challenge_pk>[0-9]+)/challenge_phase/(?P<challenge_phase_pk>[0-9]+)/analytics$",
2323
views.get_challenge_phase_submission_analysis,
2424
name="get_challenge_phase_submission_analysis",
2525
),
26-
url(
26+
re_path(
2727
r"^challenge/(?P<challenge_pk>[0-9]+)/challenge_phase/(?P<challenge_phase_pk>[0-9]+)/count$",
2828
views.get_challenge_phase_submission_count_by_team,
2929
name="get_challenge_phase_submission_count_by_team",
3030
),
31-
url(
31+
re_path(
3232
r"^challenge/(?P<challenge_pk>[0-9]+)/challenge_phase/"
3333
r"(?P<challenge_phase_pk>[0-9]+)/last_submission/(?P<submission_by>[A-Za-z_]+)$",
3434
views.get_last_submission_time,
3535
name="get_last_submission_time",
3636
),
37-
url(
37+
re_path(
3838
r"^challenge/(?P<challenge_pk>[0-9]+)/challenge_phase/"
3939
r"(?P<challenge_phase_pk>[0-9]+)/last_submission_datetime_analysis/$",
4040
views.get_last_submission_datetime_analysis,
4141
name="get_last_submission_datetime_analysis",
4242
),
43-
url(
43+
re_path(
4444
r"^challenges/(?P<challenge_pk>[0-9]+)/download_all_participants/$",
4545
views.download_all_participants,
4646
name="download_all_participants",

apps/analytics/views.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,8 @@ def get_last_submission_time(
205205
serializer = LastSubmissionDateTimeSerializer(last_submitted_at)
206206
return Response(serializer.data, status=status.HTTP_200_OK)
207207

208-
else:
209-
response_data = {"error": "Page not found!"}
210-
return Response(response_data, status=status.HTTP_404_NOT_FOUND)
208+
response_data = {"error": "Page not found!"}
209+
return Response(response_data, status=status.HTTP_404_NOT_FOUND)
211210

212211

213212
@api_view(["GET"])
@@ -358,8 +357,8 @@ def download_all_participants(request, challenge_pk):
358357
]
359358
)
360359
return response
361-
else:
362-
response_data = {
363-
"error": "Sorry, you are not authorized to make this request"
364-
}
365-
return Response(response_data, status=status.HTTP_400_BAD_REQUEST)
360+
361+
response_data = {
362+
"error": "Sorry, you are not authorized to make this request"
363+
}
364+
return Response(response_data, status=status.HTTP_400_BAD_REQUEST)

0 commit comments

Comments
 (0)