Skip to content

Commit

Permalink
Merge pull request #1943 from gtech-mulearn/dev
Browse files Browse the repository at this point in the history
Added razorpay sdk
  • Loading branch information
gtechmulearn authored May 11, 2024
2 parents db0eaa0 + 039b35f commit fb1eeb1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
52 changes: 25 additions & 27 deletions api/dashboard/campus/campus_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,32 @@ def get(self, request):


class CampusStudentInEachLevelAPI(APIView):
# authentication_classes = [CustomizePermission]

# @role_required([RoleType.CAMPUS_LEAD.value, RoleType.LEAD_ENABLER.value])
def get():
pass
# user_id = JWTUtils.fetch_user_id(request)

# if not (user_org_link := get_user_college_link(user_id)):
# return CustomResponse(
# general_message="User have no organization"
# ).get_failure_response()

# if user_org_link.org is None:
# return CustomResponse(
# general_message="Campus lead has no college"
# ).get_failure_response()

# level_with_student_count = Level.objects.annotate(
# students=Count(
# "user_lvl_link_level__user",
# filter=Q(
# user_lvl_link_level__user__user_organization_link_user__org=user_org_link.org
# ),
# )
# ).values(level=F("level_order"), students=F("students"))

# return CustomResponse(response=level_with_student_count).get_success_response()
authentication_classes = [CustomizePermission]

@role_required([RoleType.CAMPUS_LEAD.value, RoleType.LEAD_ENABLER.value])
def get(self, request):
user_id = JWTUtils.fetch_user_id(request)

if not (user_org_link := get_user_college_link(user_id)):
return CustomResponse(
general_message="User have no organization"
).get_failure_response()

if user_org_link.org is None:
return CustomResponse(
general_message="Campus lead has no college"
).get_failure_response()

level_with_student_count = Level.objects.annotate(
students=Count(
"user_lvl_link_level__user",
filter=Q(
user_lvl_link_level__user__user_organization_link_user__org=user_org_link.org
),
)
).values(level=F("level_order"), students=F("students"))

return CustomResponse(response=level_with_student_count).get_success_response()


class CampusStudentDetailsAPI(APIView):
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ tzdata==2023.3
zope.interface==6.1
qrcode==7.4.2
pymysql==1.0.2
razorpay==1.4.2

0 comments on commit fb1eeb1

Please sign in to comment.