Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed inf validation and logs every inf and jnf request #187

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions CDC_Backend/APIs/companyViews.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
RECAPTCHA_VALUE, JOB_LOCATION
])
def addPlacement(request):
logger.info("JNF filled by " + str(request.data['email']))
logger.info(json.dumps(request.data))
try:
data = request.data
files = request.FILES
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]) == "":
raise ValueError('Allowed Branch cannot be empty')
elif set(json.loads(data[ALLOWED_BATCH])).issubset(BATCHES):
if ALLOWED_BATCH in data[ALLOWED_BATCH] and data[ALLOWED_BATCH] is None or json.loads(data[ALLOWED_BATCH]) == "":
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:
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')
Expand Down