From d4e6292d9064e44945d0ea5e7e823e9b0f736b85 Mon Sep 17 00:00:00 2001 From: Gowtham Sai <66207607+gowtham3105@users.noreply.github.com> Date: Sat, 18 Dec 2021 18:12:25 +0530 Subject: [PATCH] Updated APIs --- CDC_Backend/APIs/adminViews.py | 2 +- CDC_Backend/APIs/studentViews.py | 7 +++---- CDC_Backend/APIs/utils.py | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CDC_Backend/APIs/adminViews.py b/CDC_Backend/APIs/adminViews.py index 19ab9af..eaa3741 100644 --- a/CDC_Backend/APIs/adminViews.py +++ b/CDC_Backend/APIs/adminViews.py @@ -200,7 +200,7 @@ def submitApplication(request, id, email, user_type): opening = get_object_or_404(Placement, id=data[OPENING_ID], allowed_batch__contains=[student.batch], allowed_branch__contains=[student.branch], - deadline_datetime__gte=datetime.datetime.now().date() + deadline_datetime__gte=datetime.datetime.now() ) if not opening.offer_accepted or not opening.email_verified: raise PermissionError("Placement Not Approved") diff --git a/CDC_Backend/APIs/studentViews.py b/CDC_Backend/APIs/studentViews.py index 946e52f..664c7cc 100644 --- a/CDC_Backend/APIs/studentViews.py +++ b/CDC_Backend/APIs/studentViews.py @@ -1,6 +1,5 @@ import json -from datetime import datetime - +import datetime from rest_framework.decorators import api_view from .serializers import * @@ -72,7 +71,7 @@ def getDashboard(request, id, email, user_type): placements = Placement.objects.filter(allowed_batch__contains=[studentDetails.batch], allowed_branch__contains=[studentDetails.branch], - deadline_datetime__gte=datetime.now(), + deadline_datetime__gte=datetime.datetime.now(), offer_accepted=True, email_verified=True).order_by('deadline_datetime') placementsdata = PlacementSerializerForStudent(placements, many=True).data @@ -140,7 +139,7 @@ def submitApplication(request, id, email, user_type): opening = get_object_or_404(Placement, id=data[OPENING_ID], allowed_batch__contains=[student.batch], allowed_branch__contains=[student.branch], - deadline_datetime__gte=datetime.now().date() + deadline_datetime__gte=datetime.datetime.now() ) if not opening.offer_accepted or not opening.email_verified: raise PermissionError("Placement Not Approved") diff --git a/CDC_Backend/APIs/utils.py b/CDC_Backend/APIs/utils.py index d00e35c..2784ec7 100644 --- a/CDC_Backend/APIs/utils.py +++ b/CDC_Backend/APIs/utils.py @@ -154,7 +154,7 @@ def PlacementApplicationConditions(student, placement): try: selected_companies = PlacementApplication.objects.filter(student=student, selected=True) selected_companies_PSU = [i for i in selected_companies if i.placement.tier == 'psu'] - PPO = PrePlacementOffer.objects.filter(student=student, accepted=True) + PPO = PrePlacementOffer.objects.filter(student=student, offer_accepted=True) if len(selected_companies) + len(PPO) >= MAX_OFFERS_PER_STUDENT: raise PermissionError("Max Applications Reached for the Season")