From cdf1e7bf192df7a683b0c9d7c09af99f2a8bc12b Mon Sep 17 00:00:00 2001 From: karthikmurakonda Date: Thu, 9 Nov 2023 17:45:29 +0530 Subject: [PATCH 1/3] fixed inf validation and logs every inf and jnf request --- CDC_Backend/APIs/companyViews.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CDC_Backend/APIs/companyViews.py b/CDC_Backend/APIs/companyViews.py index cd73ce6..9ffb803 100644 --- a/CDC_Backend/APIs/companyViews.py +++ b/CDC_Backend/APIs/companyViews.py @@ -17,6 +17,8 @@ logger = logging.getLogger('db') RECAPTCHA_VALUE, JOB_LOCATION ]) def addPlacement(request): + logger.info("INF filled by " + str(request.data['email'])) + logger.info(json.dumps(request.data)) try: data = request.data files = request.FILES @@ -353,6 +355,7 @@ def autoFillInf(request): CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, RECAPTCHA_VALUE]) def addInternship(request): logger.info("INF filled by " + str(request.data['email'])) + logger.info(json.dumps(request.data)) try: data = request.data files = request.FILES @@ -416,12 +419,12 @@ def addInternship(request): else: internship.is_work_from_home = False - if data[ALLOWED_BATCH] is None or json.loads(data[ALLOWED_BATCH]) == "": + if ALLOWED_BATCH in data[ALLOWED_BATCH] and data[ALLOWED_BATCH] is None or json.loads(data[ALLOWED_BATCH]) == "": raise ValueError('Allowed Branch cannot be empty') - elif set(json.loads(data[ALLOWED_BATCH])).issubset(BATCHES): + elif ALLOWED_BATCH in data[ALLOWED_BATCH] and set(json.loads(data[ALLOWED_BATCH])).issubset(BATCHES): internship.allowed_batch = json.loads(data[ALLOWED_BATCH]) else: - raise ValueError('Allowed Batch must be a subset of ' + str(BATCHES)) + internship.allowed_batch = ['2021'] if data[ALLOWED_BRANCH] is None or json.loads(data[ALLOWED_BRANCH]) == "": raise ValueError('Allowed Branch cannot be empty') From 8fe297c490360bd696e6a9f311dd98375848022d Mon Sep 17 00:00:00 2001 From: uttamthummala <84305043+uttamthummala@users.noreply.github.com> Date: Thu, 9 Nov 2023 18:26:06 +0530 Subject: [PATCH 2/3] fixed typo --- CDC_Backend/APIs/companyViews.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CDC_Backend/APIs/companyViews.py b/CDC_Backend/APIs/companyViews.py index 9ffb803..83410f6 100644 --- a/CDC_Backend/APIs/companyViews.py +++ b/CDC_Backend/APIs/companyViews.py @@ -17,7 +17,7 @@ logger = logging.getLogger('db') RECAPTCHA_VALUE, JOB_LOCATION ]) def addPlacement(request): - logger.info("INF filled by " + str(request.data['email'])) + logger.info("JNF filled by " + str(request.data['email'])) logger.info(json.dumps(request.data)) try: data = request.data From 1c3103ed4ab6c6ea96fe7a6eb41a382b620bbf3e Mon Sep 17 00:00:00 2001 From: uttamthummala <84305043+uttamthummala@users.noreply.github.com> Date: Thu, 9 Nov 2023 18:37:36 +0530 Subject: [PATCH 3/3] fixed typo --- CDC_Backend/APIs/companyViews.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CDC_Backend/APIs/companyViews.py b/CDC_Backend/APIs/companyViews.py index 83410f6..d721b12 100644 --- a/CDC_Backend/APIs/companyViews.py +++ b/CDC_Backend/APIs/companyViews.py @@ -420,7 +420,7 @@ def addInternship(request): internship.is_work_from_home = False if ALLOWED_BATCH in data[ALLOWED_BATCH] and data[ALLOWED_BATCH] is None or json.loads(data[ALLOWED_BATCH]) == "": - raise ValueError('Allowed Branch cannot be empty') + raise ValueError('Allowed Batches cannot be empty') elif ALLOWED_BATCH in data[ALLOWED_BATCH] and set(json.loads(data[ALLOWED_BATCH])).issubset(BATCHES): internship.allowed_batch = json.loads(data[ALLOWED_BATCH]) else: