changes to eligibility filter

This commit is contained in:
NitinVangipuram 2024-08-04 17:25:53 +05:30
parent 32fb8c5d6a
commit 18c3d9b046
5 changed files with 27 additions and 23 deletions

View File

@ -84,11 +84,9 @@ def addPlacement(request):
# Add a contact person details in the opening # Add a contact person details in the opening
opening.contact_person_name = data[CONTACT_PERSON_NAME] opening.contact_person_name = data[CONTACT_PERSON_NAME]
# Check if Phone number is Integer # Check if Phone number is Integer
if data[PHONE_NUMBER].isdigit():
opening.phone_number = int(data[PHONE_NUMBER]) opening.phone_number = data[PHONE_NUMBER]
else:
raise ValueError('Phone number should be integer')
opening.email = data[EMAIL] opening.email = data[EMAIL]
# Add a company location in the opening # Add a company location in the opening

View File

@ -10,6 +10,7 @@ BRANCH_CHOICES = [
['EP', 'EP'], ['EP', 'EP'],
['CIVIL', 'CIVIL'], ['CIVIL', 'CIVIL'],
['CHEMICAL', 'CHEMICAL'], ['CHEMICAL', 'CHEMICAL'],
['MNC','MNC']
] ]
ELIGIBLE_CHOICES = [ ELIGIBLE_CHOICES = [
["Btech", "Btech"], ["Btech", "Btech"],
@ -41,6 +42,7 @@ BATCHES = [ #change it accordingly
"2020", "2020",
] ]
BATCH_CHOICES = [ BATCH_CHOICES = [
["2023","2023"],
["2022", "2022"], ["2022", "2022"],
["2021", "2021"], ["2021", "2021"],
["2020", "2020"], ["2020", "2020"],
@ -65,7 +67,7 @@ TIERS = [
['7', 'Tier 7'], ['7', 'Tier 7'],
['8', 'Open Tier'], ['8', 'Open Tier'],
] ]
bTech = 'Btech'
# not being used anywhere # not being used anywhere
DEGREE_CHOICES = [ DEGREE_CHOICES = [
['bTech', 'B.Tech'], ['bTech', 'B.Tech'],
@ -84,7 +86,10 @@ CDC_REPS_EMAILS = [
"satyapriya.gupta@iitdh.ac.in", "satyapriya.gupta@iitdh.ac.in",
"dhriti.ghosh@iitdh.ac.in", "dhriti.ghosh@iitdh.ac.in",
"suvamay.jana@iitdh.ac.in", "suvamay.jana@iitdh.ac.in",
"ramesh.nayaka@iitdh.ac.in" "ramesh.nayaka@iitdh.ac.in",
"210010003@iitdh.ac.in",
"210010046@iitdh.ac.in",
"210030035@iitdh.ac.in",
] ]
CDC_REPS_EMAILS_FOR_ISSUE=[ #add reps emails CDC_REPS_EMAILS_FOR_ISSUE=[ #add reps emails
"cdc.support@iitdh.ac.in", "cdc.support@iitdh.ac.in",

View File

@ -92,7 +92,7 @@ class Placement(models.Model):
default=list, blank=True) default=list, blank=True)
is_company_details_pdf = models.BooleanField(blank=False, default=False) is_company_details_pdf = models.BooleanField(blank=False, default=False)
contact_person_name = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT) contact_person_name = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
phone_number = models.PositiveBigIntegerField(blank=False) phone_number = models.CharField(max_length=15, blank=False)
email = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="") email = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
city = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="") city = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
state = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="") state = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
@ -383,7 +383,7 @@ class Internship(models.Model):
is_selection_procedure_details_pdf = models.BooleanField(blank=False, default=False) is_selection_procedure_details_pdf = models.BooleanField(blank=False, default=False)
#contact details of company person #contact details of company person
contact_person_name = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT) contact_person_name = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
phone_number = models.PositiveBigIntegerField(blank=False) phone_number = models.CharField(max_length=15, blank=False)
email = models.EmailField(blank=False) email = models.EmailField(blank=False)
# contact_person_designation = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="") # contact_person_designation = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
# telephone_number = models.PositiveBigIntegerField(blank=True, default=None, null=True) # telephone_number = models.PositiveBigIntegerField(blank=True, default=None, null=True)

View File

@ -1,3 +1,4 @@
from datetime import datetime as dt
from rest_framework.decorators import api_view from rest_framework.decorators import api_view
from django.db.models import Q from django.db.models import Q
@ -104,7 +105,7 @@ def getDashboard(request, id, email, user_type):
filters = Q( filters = Q(
allowed_branch__contains=[studentDetails.branch], allowed_branch__contains=[studentDetails.branch],
eligiblestudents__contains=[studentDetails.degree], eligiblestudents__contains=[studentDetails.degree],
deadline_datetime__gte=datetime.now(), deadline_datetime__gte=dt.now(),
offer_accepted=True, offer_accepted=True,
email_verified=True email_verified=True
) )

View File

@ -238,38 +238,38 @@ def PlacementApplicationConditions(student, placement):
PPO_PSU = [i for i in PPO if i.tier == 'psu'] PPO_PSU = [i for i in PPO if i.tier == 'psu']
# find length of PPO # find length of PPO
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 Season1")
if len(selected_companies_PSU) > 0: if len(selected_companies_PSU) > 0:
raise PermissionError('Selected for PSU Can\'t apply anymore') raise PermissionError('Selected for PSU Can\'t apply anymore2')
if len(PPO_PSU) > 0: if len(PPO_PSU) > 0:
raise PermissionError('Selected for PSU Can\'t apply anymore') raise PermissionError('Selected for PSU Can\'t apply anymore3')
if placement.tier == 'psu': if placement.tier == 'psu':
return True, "Conditions Satisfied" return True, "Conditions Satisfied"
for i in selected_companies: for i in selected_companies:
if 1.5 * i.compensation_CTC > placement.compensation_CTC: if 1.5 * i.placement.compensation_CTC > placement.compensation_CTC:
return False, "Can't apply for this Placement, 1.5 times CTC condition not satisfied" return False, "Can't apply for this Placement, 1.5 times CTC condition not satisfied"
for i in PPO: for i in PPO:
if 1.5 * i.compensation_CTC > placement.compensation_CTC: if 1.5 * i.compensation > placement.compensation_CTC:
return False, "Can't apply for this Placement, 1.5 times CTC condition not satisfied" return False, "Can't apply for this Placement, 1.5 times CTC condition not satisfied"
if student.degree not in placement.eligiblestudents: if student.degree not in placement.eligiblestudents:
raise PermissionError("Can't apply for this placement") raise PermissionError("Can't apply for this placement4")
if student.degree == 'bTech' and student.batch not in placement.allowed_batch: if student.degree == bTech and student.batch not in placement.allowed_batch:
raise PermissionError("Can't apply for this placement") raise PermissionError("Can't apply for this placement5")
if student.branch not in placement.allowed_branch: if student.branch not in placement.allowed_branch:
raise PermissionError("Can't apply for this placement") raise PermissionError("Can't apply for this placement6")
if student.can_apply == False: if student.can_apply == False:
raise PermissionError("Can't apply for this placement") raise PermissionError("Can't apply for this placement7")
if student.isBacklog == True and placement.backlog_eligible == False: if student.isBacklog == True and placement.backlog_eligible == False:
raise PermissionError("Can't apply for this placement") raise PermissionError("Can't apply for this placement8")
if student.isPwd == True and placement.pwd_eligible == False: if student.isPwd == True and placement.pwd_eligible == False:
raise PermissionError("Can't apply for this placement") raise PermissionError("Can't apply for this placement9")
if placement.cpi_eligible > student.cpi: if placement.cpi_eligible > student.cpi:
raise PermissionError("Can't apply for this placement") raise PermissionError("Can't apply for this placement10")
return True, "Conditions Satisfied" return True, "Conditions Satisfied"