Updated APIs
This commit is contained in:
parent
21bee24197
commit
d4e6292d90
|
@ -200,7 +200,7 @@ def submitApplication(request, id, email, user_type):
|
||||||
opening = get_object_or_404(Placement, id=data[OPENING_ID],
|
opening = get_object_or_404(Placement, id=data[OPENING_ID],
|
||||||
allowed_batch__contains=[student.batch],
|
allowed_batch__contains=[student.batch],
|
||||||
allowed_branch__contains=[student.branch],
|
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:
|
if not opening.offer_accepted or not opening.email_verified:
|
||||||
raise PermissionError("Placement Not Approved")
|
raise PermissionError("Placement Not Approved")
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import json
|
import json
|
||||||
from datetime import datetime
|
import datetime
|
||||||
|
|
||||||
from rest_framework.decorators import api_view
|
from rest_framework.decorators import api_view
|
||||||
|
|
||||||
from .serializers import *
|
from .serializers import *
|
||||||
|
@ -72,7 +71,7 @@ def getDashboard(request, id, email, user_type):
|
||||||
|
|
||||||
placements = Placement.objects.filter(allowed_batch__contains=[studentDetails.batch],
|
placements = Placement.objects.filter(allowed_batch__contains=[studentDetails.batch],
|
||||||
allowed_branch__contains=[studentDetails.branch],
|
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')
|
offer_accepted=True, email_verified=True).order_by('deadline_datetime')
|
||||||
placementsdata = PlacementSerializerForStudent(placements, many=True).data
|
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],
|
opening = get_object_or_404(Placement, id=data[OPENING_ID],
|
||||||
allowed_batch__contains=[student.batch],
|
allowed_batch__contains=[student.batch],
|
||||||
allowed_branch__contains=[student.branch],
|
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:
|
if not opening.offer_accepted or not opening.email_verified:
|
||||||
raise PermissionError("Placement Not Approved")
|
raise PermissionError("Placement Not Approved")
|
||||||
|
|
|
@ -154,7 +154,7 @@ def PlacementApplicationConditions(student, placement):
|
||||||
try:
|
try:
|
||||||
selected_companies = PlacementApplication.objects.filter(student=student, selected=True)
|
selected_companies = PlacementApplication.objects.filter(student=student, selected=True)
|
||||||
selected_companies_PSU = [i for i in selected_companies if i.placement.tier == 'psu']
|
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:
|
if len(selected_companies) + len(PPO) >= MAX_OFFERS_PER_STUDENT:
|
||||||
raise PermissionError("Max Applications Reached for the Season")
|
raise PermissionError("Max Applications Reached for the Season")
|
||||||
|
|
Loading…
Reference in New Issue