Compare commits

..

No commits in common. "642ad8e326d5e24df39f32e4a88a69bb616bdcd4" and "e184d2af53f5a4f5d04de8fa498da56af62d72af" have entirely different histories.

1 changed files with 21 additions and 17 deletions

View File

@ -128,7 +128,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 +206,14 @@ 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(
opening = get_object_or_404(
Placement,
id=data[OPENING_ID],
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))
deadline_datetime__gte=timezone.now(),
# Only check allowed_batch if the degree is Btech
**({"allowed_batch__contains": [student.batch]} if student.degree == "Btech" else {})
)
if not opening.offer_accepted or not opening.email_verified:
raise PermissionError("Placement Not Approved")
@ -224,14 +230,12 @@ 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_branch__contains=[student.branch],
deadline_datetime__gte=timezone.now()
# Only check allowed_batch if the degree is Btech
**({"allowed_batch__contains": [student.batch]} if student.degree == "Btech" else {})
)
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")