Compare commits

..

1 Commits

Author SHA1 Message Date
Challenger 48451b9060
Merge f0a02ec2d0 into a6ec89f1c6 2024-09-12 08:37:54 +00:00
2 changed files with 24 additions and 42 deletions

View File

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

View File

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