From 07750f7f5d81f45547a4502aca07fb1ef5be6ac5 Mon Sep 17 00:00:00 2001 From: gaur-abhi524 <82049206+gaur-abhi524@users.noreply.github.com> Date: Fri, 10 Feb 2023 23:50:21 +0530 Subject: [PATCH 01/17] =?UTF-8?q?Fix=20problem=20regarding=20fetching=20ba?= =?UTF-8?q?tch=20for=20students=20enrolled=20in=20batch=202=E2=80=A6=20(#1?= =?UTF-8?q?030)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FusionIIIT/applications/scholarships/helpers.py | 14 ++++++++++++++ FusionIIIT/applications/scholarships/views.py | 10 ++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 FusionIIIT/applications/scholarships/helpers.py diff --git a/FusionIIIT/applications/scholarships/helpers.py b/FusionIIIT/applications/scholarships/helpers.py new file mode 100644 index 000000000..489f340a4 --- /dev/null +++ b/FusionIIIT/applications/scholarships/helpers.py @@ -0,0 +1,14 @@ +import subprocess +from datetime import datetime + +from django.conf import settings + + +def getBatch(roll): + batch = "20" + if(str(roll)[2].isdigit()): + return str(roll)[0:4] + + else: + batch+=str(roll)[0:2] + return batch \ No newline at end of file diff --git a/FusionIIIT/applications/scholarships/views.py b/FusionIIIT/applications/scholarships/views.py index 5f547149f..ba5d4bec5 100755 --- a/FusionIIIT/applications/scholarships/views.py +++ b/FusionIIIT/applications/scholarships/views.py @@ -23,6 +23,7 @@ from .validations import MCM_list, MCM_schema, gold_list, gold_schema, silver_list, silver_schema, proficiency_list,proficiency_schema from jsonschema import validate from jsonschema.exceptions import ValidationError +from .helpers import getBatch # Create your views here. @@ -1039,24 +1040,25 @@ def sendStudentRenderRequest(request, additionalParams={}): update_con_flag = False x_notif_mcm_flag = False x_notif_con_flag = False + student_batch = getBatch(request.user.extrainfo.student) for dates in release: if checkDate(dates.startdate, dates.enddate): - if dates.award == 'Merit-cum-Means Scholarship' and dates.batch == str(request.user.extrainfo.student)[0:4] and dates.programme == request.user.extrainfo.student.programme: + if dates.award == 'Merit-cum-Means Scholarship' and dates.batch == student_batch and dates.programme == request.user.extrainfo.student.programme: x_notif_mcm_flag = True if no_of_mcm_filled > 0: update_mcm_flag = True - elif dates.award == 'Convocation Medals' and dates.batch == str(request.user.extrainfo.student)[0:4] and dates.programme == request.user.extrainfo.student.programme: + elif dates.award == 'Convocation Medals' and dates.batch == student_batch and dates.programme == request.user.extrainfo.student.programme: x_notif_con_flag = True if no_of_con_filled > 0: update_con_flag = True else: - if dates.award == "Merit-cum-Means Scholarship" and dates.batch == str(request.user.extrainfo.student)[0:4]: + if dates.award == "Merit-cum-Means Scholarship" and dates.batch == student_batch: try: x = Notification.objects.select_related('student_id','release_id').get( student_id=request.user.extrainfo.id, release_id=dates.id).delete() except: pass - elif dates.award == 'Convocation Medals' and dates.batch == str(request.user.extrainfo.student)[0:4]: + elif dates.award == 'Convocation Medals' and dates.batch == student_batch: try: x = Notification.objects.select_related('student_id','release_id').get( student_id=request.user.extrainfo.id, release_id=dates.id).delete() From 91e248c3dba56d2a8db04cdaf5f774d202803e73 Mon Sep 17 00:00:00 2001 From: gaur-abhi524 <82049206+gaur-abhi524@users.noreply.github.com> Date: Mon, 13 Feb 2023 15:52:01 +0530 Subject: [PATCH 02/17] Fix form render for students of 2020 batch and later (#1103) --- FusionIIIT/applications/scholarships/views.py | 9 +++------ FusionIIIT/templates/dashboard/modules.html | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/FusionIIIT/applications/scholarships/views.py b/FusionIIIT/applications/scholarships/views.py index ba5d4bec5..ef9c33c87 100755 --- a/FusionIIIT/applications/scholarships/views.py +++ b/FusionIIIT/applications/scholarships/views.py @@ -99,13 +99,11 @@ def convener_view(request): ) # It updates the student Notification table on the spacs head sending the mcm invitation - if batch == 'all': + if batch.lower() == 'all': active_batches = range(datetime.datetime.now().year - 4 , datetime.datetime.now().year + 1) - query = reduce(or_, (Q(id__id__startswith=batch) for batch in active_batches)) - recipient = Student.objects.filter(programme=programme).filter(query) + recipient = Student.objects.filter(programme=programme).filter(batch__in=active_batches) else: - recipient = Student.objects.filter(programme=programme, id__id__startswith=batch) - + recipient = Student.objects.filter(programme=programme, batch=batch) # Notification starts convenor = request.user for student in recipient: @@ -1013,7 +1011,6 @@ def sendConvenerRenderRequest(request, additionalParams={}): source = Constants.FATHER_OCC_CHOICE time = Constants.TIME release = Release.objects.all() - notification = Notification.objects.select_related('student_id','release_id').all() spi = Spi.objects.all() context.update({ 'source': source, 'time': time, 'ch': ch, 'spi': spi, 'release': release}) context.update(additionalParams) diff --git a/FusionIIIT/templates/dashboard/modules.html b/FusionIIIT/templates/dashboard/modules.html index 73fc33d85..3a33bda1b 100755 --- a/FusionIIIT/templates/dashboard/modules.html +++ b/FusionIIIT/templates/dashboard/modules.html @@ -116,7 +116,7 @@ {% comment %}A single modules row starts here!{% endcomment %}