Compare commits

..

12 Commits

Author SHA1 Message Date
Challenger 1b1543d2af
Merge f0a02ec2d0 into 90f028651d 2024-11-30 23:38:21 +00:00
Jaya Surya P 90f028651d
Merge pull request #207 from CDC-IITDH/nitin
fixed add/edit application & markstatus issue in intenship
2024-10-25 22:55:13 +05:30
NitinVangipuram 3d42366e50 fixed export csv error 2024-10-25 22:54:22 +05:30
NitinVangipuram 95d7689a4c fixed add/edit application & markstatus issue in intenship 2024-10-24 20:10:02 +05:30
Jaya Surya P 642ad8e326
Merge pull request #206 from CDC-IITDH/nitin
fixed submit application error
2024-10-08 19:03:48 +05:30
NitinVangipuram 8aa7246ec9 fixed submit application error 2024-10-08 19:01:34 +05:30
Jaya Surya P e184d2af53
Merge pull request #205 from CDC-IITDH/nitin
fixed submit application error for Mtech ,Ms
2024-10-05 09:34:53 +05:30
NitinVangipuram e717cbc6e6 Merge branch 'main' of https://github.com/CDC-IITDH/cdc-placement-website-backend into nitin 2024-10-02 17:11:13 +05:30
NitinVangipuram e242fff9a7 fixed submit application error 2024-10-02 17:10:27 +05:30
Jaya Surya P 4c248be3a5
Merge pull request #204 from CDC-IITDH/nitin
fixed stats
2024-09-26 17:00:02 +05:30
Jaya Surya P 7eee78177c
Merge branch 'main' into nitin 2024-09-26 16:59:55 +05:30
NitinVangipuram ce97fc8342 fixed stats 2024-09-26 12:18:55 +05:30
2 changed files with 42 additions and 24 deletions

View File

@ -310,13 +310,17 @@ def submitApplication(request, id, email, user_type):
try: try:
data = request.data data = request.data
if OPENING_TYPE in data: if OPENING_TYPE in data:
opening_type= data[OPENING_TYPE] if data[OPENING_TYPE] == "Internship":
opening_type= "Internship"
elif data[OPENING_TYPE] == "placements":
opening_type= "Placement"
else: else:
opening_type= "Placement" opening_type= "Placement"
if opening_type == "Internship": if opening_type == "Internship":
opening = get_object_or_404(Internship, pk=data[OPENING_ID]) opening = get_object_or_404(Internship, pk=data[OPENING_ID])
else: else:
opening = get_object_or_404(Placement, pk=data[OPENING_ID]) opening = get_object_or_404(Placement, pk=data[OPENING_ID])
# print(opening);
student = get_object_or_404(Student, pk=data[STUDENT_ID]) student = get_object_or_404(Student, pk=data[STUDENT_ID])
# opening = get_object_or_404(Placement, pk=data[OPENING_ID]) # opening = get_object_or_404(Placement, pk=data[OPENING_ID])
student_user = get_object_or_404(User, id=student.id) student_user = get_object_or_404(User, id=student.id)
@ -446,8 +450,7 @@ def generateCSV(request, id, email, user_type):
row_details.append(apl.selected) row_details.append(apl.selected)
for i in opening.additional_info: for i in opening.additional_info:
row_details.append(json.loads(apl.additional_info)[i]) row_details.append(json.loads(apl.additional_info).get(i, ''))
writer.writerow(row_details) writer.writerow(row_details)
f.close() f.close()
file_path = LINK_TO_APPLICATIONS_CSV + urllib.parse.quote_plus(filename + ".csv") file_path = LINK_TO_APPLICATIONS_CSV + urllib.parse.quote_plus(filename + ".csv")
@ -623,6 +626,17 @@ def getStats(request, id, email, user_type):
"psu":0, "psu":0,
}, },
"EP":{
"1":0,
"2":0,
"3":0,
"4":0,
"5":0,
"6":0,
"7":0,
"8":0,
"psu":0,
},
"Total": { "Total": {
"1":0, "1":0,
"2":0, "2":0,
@ -639,6 +653,7 @@ def getStats(request, id, email, user_type):
"CSE": 0, "CSE": 0,
"EE": 0, "EE": 0,
"MMAE": 0, "MMAE": 0,
"EP": 0,
"Total": 0, "Total": 0,
} }
number_of_students_with_multiple_offers = 0 number_of_students_with_multiple_offers = 0
@ -646,22 +661,26 @@ def getStats(request, id, email, user_type):
"CSE": 0, "CSE": 0,
"EE": 0, "EE": 0,
"MMAE": 0, "MMAE": 0,
"EP": 0,
"Total": 0, "Total": 0,
} }
max_CTC = { max_CTC = {
"CSE": 0, "CSE": 0,
"EE": 0, "EE": 0,
"MMAE": 0 "MMAE": 0,
"EP": 0,
} }
average_CTC = { average_CTC = {
"CSE": 0, "CSE": 0,
"EE": 0, "EE": 0,
"MMAE": 0 "MMAE": 0,
"EP": 0,
} }
count = { count = {
"CSE": 0, "CSE": 0,
"EE": 0, "EE": 0,
"MMAE": 0 "MMAE": 0,
"EP": 0,
} }

View File

@ -116,7 +116,6 @@ def getDashboard(request, id, email, user_type):
placements = Placement.objects.filter(filters).order_by('deadline_datetime') placements = Placement.objects.filter(filters).order_by('deadline_datetime')
filtered_placements = placement_eligibility_filters(studentDetails, placements) filtered_placements = placement_eligibility_filters(studentDetails, placements)
placementsdata = PlacementSerializerForStudent(filtered_placements, many=True).data placementsdata = PlacementSerializerForStudent(filtered_placements, many=True).data
placementApplications = PlacementApplication.objects.filter(student_id=id).order_by('-updated_at') placementApplications = PlacementApplication.objects.filter(student_id=id).order_by('-updated_at')
@ -129,13 +128,7 @@ def getDashboard(request, id, email, user_type):
email_verified=True email_verified=True
).order_by('deadline_datetime') ).order_by('deadline_datetime')
else: else:
internships = Internship.objects.filter( internships = Internship.objects.filter(filters).order_by('deadline_datetime')
allowed_batch__contains=[studentDetails.batch],
allowed_branch__contains=[studentDetails.branch],
deadline_datetime__gte=datetime.datetime.now(),
offer_accepted=True,
email_verified=True
).order_by('deadline_datetime')
filtered_internships = internship_eligibility_filters(studentDetails, internships) filtered_internships = internship_eligibility_filters(studentDetails, internships)
@ -207,11 +200,14 @@ def submitApplication(request, id, email, user_type):
if not len(PlacementApplication.objects.filter( if not len(PlacementApplication.objects.filter(
student_id=id, placement_id=data[OPENING_ID])): student_id=id, placement_id=data[OPENING_ID])):
application = PlacementApplication() application = PlacementApplication()
opening = get_object_or_404(Placement, id=data[OPENING_ID], application_filters = Q(
allowed_batch__contains=[student.batch], id=data[OPENING_ID],
allowed_branch__contains=[student.branch], allowed_branch__contains=[student.branch],
deadline_datetime__gte=timezone.now() deadline_datetime__gte=timezone.now()
) )
if student.degree == "Btech":
application_filters &= Q(allowed_batch__contains=[student.batch])
opening = get_object_or_404(Placement.objects.filter(application_filters))
if not opening.offer_accepted or not opening.email_verified: if not opening.offer_accepted or not opening.email_verified:
raise PermissionError("Placement Not Approved") raise PermissionError("Placement Not Approved")
@ -228,11 +224,14 @@ def submitApplication(request, id, email, user_type):
if not len(InternshipApplication.objects.filter( if not len(InternshipApplication.objects.filter(
student_id=id, internship_id=data[OPENING_ID])): student_id=id, internship_id=data[OPENING_ID])):
application = InternshipApplication() application = InternshipApplication()
opening = get_object_or_404(Internship, id=data[OPENING_ID], application_filters = Q(
allowed_batch__contains=[student.batch], id=data[OPENING_ID],
allowed_branch__contains=[student.branch], allowed_branch__contains=[student.branch],
deadline_datetime__gte=timezone.now() deadline_datetime__gte=timezone.now()
) )
if student.degree == "Btech":
application_filters &= Q(allowed_batch__contains=[student.batch])
opening = get_object_or_404(Internship.objects.filter(application_filters))
if not opening.offer_accepted or not opening.email_verified: if not opening.offer_accepted or not opening.email_verified:
raise PermissionError("Internship Not Approved") raise PermissionError("Internship Not Approved")