Skip to content

Commit

Permalink
Merge pull request #2082 from gtech-mulearn/dev-server
Browse files Browse the repository at this point in the history
Dev server
  • Loading branch information
jelanmathewjames authored Jun 18, 2024
2 parents f5524c5 + fdd8937 commit d0133a9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions api/launchpad/launchpad_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,11 @@ def get(self, request):

# Count participants at each level
level_counts = {
"total_participants": users.count(),
"total_participants": users.values('id').count(),
"Level_1": users.filter(level=LaunchPadLevels.LEVEL_1.value).count(),
"Level_2": users.filter(level=LaunchPadLevels.LEVEL_2.value).count(),
"Level_3": users.filter(level=LaunchPadLevels.LEVEL_3.value).count(),
"Level_4": users.filter(level=LaunchPadLevels.LEVEL_4.value).count(),
"NoLevel": users.exclude(level__in=allowed_levels).count()
"Level_4": users.filter(level=LaunchPadLevels.LEVEL_4.value).count()
}

return CustomResponse(response=level_counts).get_success_response()
Expand Down Expand Up @@ -226,8 +225,8 @@ def post(self, request):
data = request.data
auth_mail = data.pop('current_user', None)
auth_mail = auth_mail[0] if isinstance(auth_mail, list) else auth_mail
# if not (auth_user := LaunchPadUsers.objects.filter(email=auth_mail, role=LaunchPadRoles.ADMIN.value).first()):
# return CustomResponse(general_message="Unauthorized").get_failure_response()
if not (auth_user := LaunchPadUsers.objects.filter(email=auth_mail, role=LaunchPadRoles.ADMIN.value).first()):
return CustomResponse(general_message="Unauthorized").get_failure_response()
serializer = LaunchpadUserSerializer(data=data)
if not serializer.is_valid():
return CustomResponse(message=serializer.errors).get_failure_response()
Expand All @@ -237,8 +236,6 @@ def post(self, request):
error = False
not_found_colleges = []
user = serializer.save()
if colleges is None:
return CustomResponse(general_message="Successfully added user").get_failure_response()
for college in colleges:
if not Organization.objects.filter(id=college, org_type="College").exists():
error = True
Expand Down

0 comments on commit d0133a9

Please sign in to comment.