Skip to content

Commit

Permalink
Merge pull request #1746 from gtech-mulearn/dev-server
Browse files Browse the repository at this point in the history
user edit prefill
  • Loading branch information
adnankattekaden authored Dec 5, 2023
2 parents 5a94719 + 7a45fc7 commit c12a068
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 54 deletions.
57 changes: 6 additions & 51 deletions api/common/common_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def get(self, request):
LearningCircle.objects.filter(org__org_type=OrganizationType.COLLEGE.value, created_at__date=date)
.values(org_title=F("org__title"))
.annotate(
learning_circle_count=Count("id"), user_count=Count("user_circle_link_circle")
learning_circle_count=Count("id"), user_count=Count("user_circle_link_user")
)
.order_by("org_title")
)
Expand All @@ -254,7 +254,7 @@ def get(self, request):
LearningCircle.objects.filter(org__org_type=OrganizationType.COLLEGE.value)
.values(org_title=F("org__title"))
.annotate(
learning_circle_count=Count("id"), user_count=Count("user_circle_link_circle")
learning_circle_count=Count("id"), user_count=Count("user_circle_link_user")
)
.order_by("org_title")
)
Expand All @@ -274,53 +274,6 @@ def get(self, request):
)


class HackathonDataAPI(APIView):

def get(self, request):
hackathon_data = {
'hackathons': {
'Beyond Us': {
"Domain": ["Software", "Design (UI,UX)"],
"total_applicants_registered": 374,
"short_listed_candidates": 231,
"total_teams_shortlisted": {"total": 58, "domains": {"Software": 40, "Design (UI,UX)": 18}},
"no_of_offer_given": {'count': 1, "status": "Offer Rejected by the candidate"},
"no_of_placements": {"count": 0, "status": None},
"attended_people": None,
"hackathon_type": "Online",
"location": "Discord"
},
'GTA: CodeStorm': {
"Domain": ["Software", "Design (UI/UX)", "Hardware", "Civil"],
"total_applicants_registered": 451,
"short_listed_candidates": 202,
"total_teams_shortlisted": {"total": 62,
"domains": {"Software": 18, "Design (UI/UX)": 17, "Hardware": 18,
"Civil": 9}},
"no_of_offer_given": {'count': 15, "status": "5 Rejected by the candidates"},
"no_of_placements": {'count': 10, "status": "2 Full time positions + 8 full time internships"},
"attended_people": 168,
"hackathon_type": "Offline",
"location": "Kochi",
},
'GTA: SandShores': {
"Domain": ["Web Development", "App Development", "AI/ML", "AR/VR"],
"total_applicants_registered": 1765,
"short_listed_candidates": 120,
"total_teams_shortlisted": {"total": 29,
"domains": {"Web Development": 12, "App Development": 7, "AI/ML": 7,
"AR/VR": 3}},
"no_of_offer_given": {'count': 0, "status": "In Progress"},
"no_of_placements": {'count': 0, "status": "In Progress"},
"attended_people": None,
"hackathon_type": "Offline",
"location": "Thrissur",
},
}
}
pass


class LearningCircleEnrollment(APIView):

def get(self, request):
Expand Down Expand Up @@ -364,9 +317,11 @@ def get(self, request):
"circle_name": "circle_name", "district": "district", "circle_ig": "circle_ig",
"organisation": "organisation", "dwms_id": "dwms_id", "karma_earned": "karma_earned"},
is_pagination=False)
lc_enrollment = LearningCircleEnrollmentSerializer(paginated_queryset, many=True).data
lc_enrollment = LearningCircleEnrollmentSerializer(paginated_queryset.get('queryset'), many=True).data

return CustomResponse(response=lc_enrollment).get_success_response()
return CustomResponse().paginated_response(
data=lc_enrollment, pagination=paginated_queryset.get("pagination")
)


class LearningCircleEnrollmentCSV(APIView):
Expand Down
1 change: 0 additions & 1 deletion api/dashboard/organisation/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
path('merge_organizations/<str:organisation_id>/', organisation_views.OrganizationMergerView.as_view()),
path('karma-type/create/', organisation_views.OrganizationKarmaTypeGetPostPatchDeleteAPI.as_view()),
path('karma-log/create/', organisation_views.OrganizationKarmaLogGetPostPatchDeleteAPI.as_view()),

path('base-template/', organisation_views.OrganisationBaseTemplateAPI.as_view()),
path('import/', organisation_views.OrganisationImportAPI.as_view()),
]
2 changes: 1 addition & 1 deletion api/dashboard/task/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
urlpatterns = [
#task_type
path('list-task-type/', dash_task_view.TaskTypeCrudAPI.as_view()), # get tasktype,create tasktype
path('list-task-type/<str:task_type_id>', dash_task_view.TaskTypeCrudAPI.as_view()), # delete,edit
path('task-type/<str:task_type_id>/', dash_task_view.TaskTypeCrudAPI.as_view()), # delete,edit

path('channel/', dash_task_view.ChannelDropdownAPI.as_view()),
path('ig/', dash_task_view.IGDropdownAPI.as_view()),
Expand Down
2 changes: 1 addition & 1 deletion api/dashboard/user/dash_user_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class UserDetailsSerializer(serializers.ModelSerializer):
organizations = serializers.SerializerMethodField(read_only=True)
interest_groups = serializers.SerializerMethodField(read_only=True)
role = serializers.SerializerMethodField(read_only=True)
district = serializers.CharField(source="district.name")
district = serializers.CharField(source="district.name", allow_null=True)

class Meta:
model = User
Expand Down
18 changes: 18 additions & 0 deletions api/register/register_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,24 @@ def post(self, request):
).get_success_response()


class SchoolAPI(APIView):
def post(self, request):
org_queryset = Organization.objects.filter(
Q(org_type=OrganizationType.SCHOOL.value),
Q(district_id=request.data.get("district")),
)

college_serializer_data = serializers.OrgSerializer(
org_queryset, many=True
).data

return CustomResponse(
response={
"schools": college_serializer_data,
}
).get_success_response()


class CommunityAPI(APIView):
def get(self, request):
community_queryset = Organization.objects.filter(
Expand Down
1 change: 1 addition & 0 deletions api/register/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
path("college/list/", register_views.CollegeAPI.as_view()),
path("company/list/", register_views.CompanyAPI.as_view()),
path("community/list/", register_views.CommunityAPI.as_view()),
path("schools/list/", register_views.SchoolAPI.as_view()),
path("area-of-interest/list/", register_views.AreaOfInterestAPI.as_view()),
path("lc/user-validation/", register_views.LearningCircleUserViewAPI.as_view()),
path('email-verification/', register_views.UserEmailVerificationAPI.as_view()),
Expand Down

0 comments on commit c12a068

Please sign in to comment.