From d918735bf815972d5562f9bc61771f80ccbef004 Mon Sep 17 00:00:00 2001 From: Gowtham Sai <66207607+gowtham3105@users.noreply.github.com> Date: Tue, 6 Dec 2022 16:16:56 +0530 Subject: [PATCH 1/2] Minor changes and PPO-PSU check --- CDC_Backend/APIs/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CDC_Backend/APIs/utils.py b/CDC_Backend/APIs/utils.py index 2f5c6fc..be57175 100644 --- a/CDC_Backend/APIs/utils.py +++ b/CDC_Backend/APIs/utils.py @@ -172,12 +172,17 @@ def PlacementApplicationConditions(student, placement): selected_companies = PlacementApplication.objects.filter(student=student, selected=True) selected_companies_PSU = [i for i in selected_companies if i.placement.tier == 'psu'] PPO = PrePlacementOffer.objects.filter(student=student, accepted=True) + 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") if len(selected_companies_PSU) > 0: raise PermissionError('Selected for PSU Can\'t apply anymore') + + if len(PPO_PSU) > 0: + raise PermissionError('Selected for PSU Can\'t apply anymore') + if placement.tier == 'psu': return True, "Conditions Satisfied" @@ -186,7 +191,7 @@ def PlacementApplicationConditions(student, placement): return False, "Can't apply for this tier" for i in PPO: - if int(i.placement.tier) < int(placement.tier): + if int(i.tier) < int(placement.tier): return False, "Can't apply for this tier" if student.degree != 'bTech' and not placement.rs_eligible: From f41a0e85e9b6e7877dd9369e4d6f04319d7b6eac Mon Sep 17 00:00:00 2001 From: Gowtham Sai <66207607+gowtham3105@users.noreply.github.com> Date: Tue, 6 Dec 2022 16:18:23 +0530 Subject: [PATCH 2/2] Adding Email Notifications to ADMINS for Warning Logs or Above --- CDC_Backend/CDC_Backend/settings.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CDC_Backend/CDC_Backend/settings.py b/CDC_Backend/CDC_Backend/settings.py index 077e389..2447ee0 100644 --- a/CDC_Backend/CDC_Backend/settings.py +++ b/CDC_Backend/CDC_Backend/settings.py @@ -30,6 +30,7 @@ DEBUG = os.environ.get('DEBUG') == "True" ALLOWED_HOSTS = ['cdc.iitdh.ac.in', 'localhost'] +ADMINS = [('Gowtham Sai', '190010036@iitdh.ac.in'), ('Karthik Mv', '200010030@iitdh.ac.in')] # Application definition INSTALLED_APPS = [ @@ -185,14 +186,13 @@ LOGGING = { 'class': 'django_db_logger.db_log_handler.DatabaseLogHandler' }, 'mail_admins': { - 'level': 'ERROR', + 'level': 'WARNING', 'class': 'django.utils.log.AdminEmailHandler', - 'include_html': True, } }, 'loggers': { 'db': { - 'handlers': ['db_log'], + 'handlers': ['db_log', 'mail_admins'], 'level': 'DEBUG' } }