From 18c3d9b0465c96251f036c11c0c695332087110d Mon Sep 17 00:00:00 2001 From: NitinVangipuram Date: Sun, 4 Aug 2024 17:25:53 +0530 Subject: [PATCH] changes to eligibility filter --- CDC_Backend/APIs/companyViews.py | 8 +++----- CDC_Backend/APIs/constants.py | 9 +++++++-- CDC_Backend/APIs/models.py | 4 ++-- CDC_Backend/APIs/studentViews.py | 3 ++- CDC_Backend/APIs/utils.py | 26 +++++++++++++------------- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/CDC_Backend/APIs/companyViews.py b/CDC_Backend/APIs/companyViews.py index 6774a13..c7636b7 100644 --- a/CDC_Backend/APIs/companyViews.py +++ b/CDC_Backend/APIs/companyViews.py @@ -84,11 +84,9 @@ def addPlacement(request): # Add a contact person details in the opening opening.contact_person_name = data[CONTACT_PERSON_NAME] # Check if Phone number is Integer - if data[PHONE_NUMBER].isdigit(): - opening.phone_number = int(data[PHONE_NUMBER]) - else: - raise ValueError('Phone number should be integer') - + + opening.phone_number = data[PHONE_NUMBER] + opening.email = data[EMAIL] # Add a company location in the opening diff --git a/CDC_Backend/APIs/constants.py b/CDC_Backend/APIs/constants.py index 435cd1e..8086e90 100644 --- a/CDC_Backend/APIs/constants.py +++ b/CDC_Backend/APIs/constants.py @@ -10,6 +10,7 @@ BRANCH_CHOICES = [ ['EP', 'EP'], ['CIVIL', 'CIVIL'], ['CHEMICAL', 'CHEMICAL'], + ['MNC','MNC'] ] ELIGIBLE_CHOICES = [ ["Btech", "Btech"], @@ -41,6 +42,7 @@ BATCHES = [ #change it accordingly "2020", ] BATCH_CHOICES = [ + ["2023","2023"], ["2022", "2022"], ["2021", "2021"], ["2020", "2020"], @@ -65,7 +67,7 @@ TIERS = [ ['7', 'Tier 7'], ['8', 'Open Tier'], ] - +bTech = 'Btech' # not being used anywhere DEGREE_CHOICES = [ ['bTech', 'B.Tech'], @@ -84,7 +86,10 @@ CDC_REPS_EMAILS = [ "satyapriya.gupta@iitdh.ac.in", "dhriti.ghosh@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.support@iitdh.ac.in", diff --git a/CDC_Backend/APIs/models.py b/CDC_Backend/APIs/models.py index dff0321..59397ca 100644 --- a/CDC_Backend/APIs/models.py +++ b/CDC_Backend/APIs/models.py @@ -92,7 +92,7 @@ class Placement(models.Model): default=list, blank=True) is_company_details_pdf = models.BooleanField(blank=False, default=False) 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="") 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="") @@ -383,7 +383,7 @@ class Internship(models.Model): is_selection_procedure_details_pdf = models.BooleanField(blank=False, default=False) #contact details of company person 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) # 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) diff --git a/CDC_Backend/APIs/studentViews.py b/CDC_Backend/APIs/studentViews.py index 55ac23a..e833af2 100644 --- a/CDC_Backend/APIs/studentViews.py +++ b/CDC_Backend/APIs/studentViews.py @@ -1,3 +1,4 @@ +from datetime import datetime as dt from rest_framework.decorators import api_view from django.db.models import Q @@ -104,7 +105,7 @@ def getDashboard(request, id, email, user_type): filters = Q( allowed_branch__contains=[studentDetails.branch], eligiblestudents__contains=[studentDetails.degree], - deadline_datetime__gte=datetime.now(), + deadline_datetime__gte=dt.now(), offer_accepted=True, email_verified=True ) diff --git a/CDC_Backend/APIs/utils.py b/CDC_Backend/APIs/utils.py index 02353c4..9224e2c 100644 --- a/CDC_Backend/APIs/utils.py +++ b/CDC_Backend/APIs/utils.py @@ -238,38 +238,38 @@ def PlacementApplicationConditions(student, placement): PPO_PSU = [i for i in PPO if i.tier == 'psu'] # find length of PPO 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: - raise PermissionError('Selected for PSU Can\'t apply anymore') + raise PermissionError('Selected for PSU Can\'t apply anymore2') 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': return True, "Conditions Satisfied" 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" 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" if student.degree not in placement.eligiblestudents: - raise PermissionError("Can't apply for this placement") - 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 placement4") + if student.degree == bTech and student.batch not in placement.allowed_batch: + raise PermissionError("Can't apply for this placement5") 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: - 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: - 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: - raise PermissionError("Can't apply for this placement") + raise PermissionError("Can't apply for this placement9") 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"