changes to fields

This commit is contained in:
NitinVangipuram 2024-07-24 23:27:27 +05:30
parent 727c53ef85
commit 6e68db7760
3 changed files with 23 additions and 8 deletions

View File

@ -14,7 +14,7 @@ logger = logging.getLogger('db')
IS_COMPENSATION_DETAILS_PDF, ALLOWED_BRANCH, ELIGIBLESTUDENTS, SELECTION_PROCEDURE_ROUNDS, IS_COMPENSATION_DETAILS_PDF, ALLOWED_BRANCH, ELIGIBLESTUDENTS, SELECTION_PROCEDURE_ROUNDS,
SELECTION_PROCEDURE_DETAILS, SELECTION_PROCEDURE_DETAILS,
IS_SELECTION_PROCEDURE_DETAILS_PDF, TENTATIVE_DATE_OF_JOINING, TENTATIVE_NO_OF_OFFERS, OTHER_REQUIREMENTS, IS_SELECTION_PROCEDURE_DETAILS_PDF, TENTATIVE_DATE_OF_JOINING, TENTATIVE_NO_OF_OFFERS, OTHER_REQUIREMENTS,
RECAPTCHA_VALUE, JOB_LOCATION,PSYCHOMETRIC_TEST,MEDICAL_TEST,COMPANY_TURNOVER,NUMBER_OF_EMPLOYEES,BACKLOG_ELIGIBLE,PWD_ELIGIBLE,CPI ,COMPANY_TURNOVER,ESTABLISHMENT_DATE ,EXPECTED_NO_OF_OFFERS]) RECAPTCHA_VALUE, JOB_LOCATION,PSYCHOMETRIC_TEST,MEDICAL_TEST,NUMBER_OF_EMPLOYEES,BACKLOG_ELIGIBLE,PWD_ELIGIBLE,CPI,EXPECTED_NO_OF_OFFERS])
def addPlacement(request): def addPlacement(request):
logger.info("JNF filled by " + str(request.data['email'])) logger.info("JNF filled by " + str(request.data['email']))
@ -139,12 +139,17 @@ def addPlacement(request):
else: else:
raise ValueError('Compensation CTC must be an integer') raise ValueError('Compensation CTC must be an integer')
# Newly added # Newly added
if data[COMPANY_TURNOVER].isdigit(): if data[COMPANY_TURNOVER].isdigit():
opening.company_turnover = int(data[COMPANY_TURNOVER]) opening.company_turnover = int(data[COMPANY_TURNOVER])
elif data[COMPANY_TURNOVER] is None: elif data[COMPANY_TURNOVER] is None or data[COMPANY_TURNOVER] == '':
opening.company_turnover = None opening.company_turnover = None
else: else:
raise ValueError('Company Turnover must be an integer') # Handle the case where the data is not a valid number or None/empty
# You can raise an error, set a default value, or log a warning
opening.company_turnover = None # Or some default value or error handling
# Check if compensation_gross is integer # Check if compensation_gross is integer
if data[COMPENSATION_GROSS].isdigit(): if data[COMPENSATION_GROSS].isdigit():
@ -455,7 +460,14 @@ def addInternship(request):
raise ValueError('Season must be a subset of ' + str(SEASONS)) raise ValueError('Season must be a subset of ' + str(SEASONS))
internship.interning_period_from = datetime.datetime.strptime(data[START_DATE], '%d-%m-%Y').date() internship.interning_period_from = datetime.datetime.strptime(data[START_DATE], '%d-%m-%Y').date()
internship.interning_period_to = datetime.datetime.strptime(data[END_DATE], '%d-%m-%Y').date() internship.interning_period_to = datetime.datetime.strptime(data[END_DATE], '%d-%m-%Y').date()
internship.establishment_date = datetime.datetime.strptime(data[ESTABLISHMENT_DATE], '%d-%m-%Y').date() # newly added field establishment_date_str = data.get('ESTABLISHMENT_DATE', '')
if establishment_date_str:
try:
internship.establishment_date = datetime.datetime.strptime(establishment_date_str, '%d-%m-%Y').date()
except ValueError:
internship.establishment_date = None
else:
internship.establishment_date = None
if data[WORK_TYPE] == 'Work from home': if data[WORK_TYPE] == 'Work from home':
internship.is_work_from_home = True internship.is_work_from_home = True
else: else:
@ -529,10 +541,12 @@ def addInternship(request):
# Newly added # Newly added
if data[COMPANY_TURNOVER].isdigit(): if data[COMPANY_TURNOVER].isdigit():
internship.company_turnover = int(data[COMPANY_TURNOVER]) internship.company_turnover = int(data[COMPANY_TURNOVER])
elif data[COMPANY_TURNOVER] is None: elif data[COMPANY_TURNOVER] is None or data[COMPANY_TURNOVER] == '':
internship.company_turnover = None internship.company_turnover = None
else: else:
raise ValueError('Company Turnover must be an integer') # Handle the case where the data is not a valid number or None/empty
# You can raise an error, set a default value, or log a warning
internship.company_turnover = None # Or some default value or error handling
# newly added # newly added
if data[EXPECTED_NO_OF_OFFERS].isdigit(): if data[EXPECTED_NO_OF_OFFERS].isdigit():
internship.expected_no_of_offers = int(data[EXPECTED_NO_OF_OFFERS]) internship.expected_no_of_offers = int(data[EXPECTED_NO_OF_OFFERS])

View File

@ -32,6 +32,7 @@ ELIGIBLE =[
"MS", "MS",
"MTech", "MTech",
"PHD", "PHD",
"BSMS",
] ]
BATCHES = [ #change it accordingly BATCHES = [ #change it accordingly
"2023", "2023",

View File

@ -109,7 +109,7 @@ class Placement(models.Model):
blank=True) blank=True)
is_description_pdf = models.BooleanField(blank=False, default=False) is_description_pdf = models.BooleanField(blank=False, default=False)
compensation_CTC = models.IntegerField(blank=False, default=None, null=True) # Job - Per Year compensation_CTC = models.IntegerField(blank=False, default=None, null=True) # Job - Per Year
company_turnover = models.IntegerField(blank=False, default=None, null=True) # newly added field company_turnover = models.IntegerField(blank=True, default=None, null=True) # newly added field
compensation_gross = models.IntegerField(blank=False, default=None, null=True) compensation_gross = models.IntegerField(blank=False, default=None, null=True)
compensation_take_home = models.IntegerField(blank=False, default=None, null=True) compensation_take_home = models.IntegerField(blank=False, default=None, null=True)
compensation_bonus = models.IntegerField(blank=True, default=None, null=True) compensation_bonus = models.IntegerField(blank=True, default=None, null=True)
@ -142,7 +142,7 @@ class Placement(models.Model):
) )
tentative_no_of_offers = models.IntegerField(blank=False, default=None, null=True) tentative_no_of_offers = models.IntegerField(blank=False, default=None, null=True)
expected_no_of_offers = models.IntegerField(blank=False , default=None , null=True) # newly added expected_no_of_offers = models.IntegerField(blank=False , default=None , null=True) # newly added
number_of_employees = models.IntegerField(blank=False, default=None, null=True) # newly added field number_of_employees = models.IntegerField(blank=True, default=None, null=True) # newly added field
eligiblestudents = ArrayField( eligiblestudents = ArrayField(
models.CharField(choices=ELIGIBLE_CHOICES, blank=False, max_length=10), models.CharField(choices=ELIGIBLE_CHOICES, blank=False, max_length=10),
size=10, size=10,