From bab382c8ec38559580b8f5f18565b8d6922fbe4c Mon Sep 17 00:00:00 2001 From: NitinVangipuram Date: Wed, 14 Aug 2024 22:42:40 +0530 Subject: [PATCH 1/2] changes to student model --- CDC_Backend/APIs/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CDC_Backend/APIs/models.py b/CDC_Backend/APIs/models.py index 59397ca..7cb799c 100644 --- a/CDC_Backend/APIs/models.py +++ b/CDC_Backend/APIs/models.py @@ -26,7 +26,7 @@ class Student(models.Model): roll_no = models.CharField(blank=False, max_length=15, unique=True) name = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT) batch = models.CharField(max_length=10, choices=BATCH_CHOICES, blank=False) - branch = models.CharField(choices=BRANCH_CHOICES, blank=False, max_length=10) + branch = models.CharField(choices=BRANCH_CHOICES, blank=True,default=None, null=True, max_length=10) phone_number = models.PositiveBigIntegerField(blank=True, default=None, null=True) resumes = ArrayField(models.CharField(null=True, default=None, max_length=JNF_TEXT_MAX_CHARACTER_COUNT), size=10, default=list, blank=True) From 020a10f71a411a63aa6cf3b3498781ab3c2ab27c Mon Sep 17 00:00:00 2001 From: NitinVangipuram Date: Thu, 15 Aug 2024 23:02:03 +0530 Subject: [PATCH 2/2] changes to internshipfilter --- CDC_Backend/APIs/studentViews.py | 20 ++++++++++++++++---- CDC_Backend/APIs/utils.py | 4 ++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CDC_Backend/APIs/studentViews.py b/CDC_Backend/APIs/studentViews.py index 025aebd..12d1815 100644 --- a/CDC_Backend/APIs/studentViews.py +++ b/CDC_Backend/APIs/studentViews.py @@ -121,10 +121,22 @@ def getDashboard(request, id, email, user_type): placementApplications = PlacementApplication.objects.filter(student_id=id).order_by('-updated_at') placementApplications = PlacementApplicationSerializer(placementApplications, many=True).data - internships = Internship.objects.filter(allowed_batch__contains=[studentDetails.batch], - allowed_branch__contains=[studentDetails.branch], - deadline_datetime__gte=datetime.datetime.now(), - offer_accepted=True, email_verified=True).order_by('deadline_datetime') + if studentDetails.degree == 'BSMS': # for BSMS branch is not considered + internships = Internship.objects.filter( + allowed_batch__contains=[studentDetails.batch], + deadline_datetime__gte=datetime.datetime.now(), + offer_accepted=True, + email_verified=True + ).order_by('deadline_datetime') + else: + internships = Internship.objects.filter( + allowed_batch__contains=[studentDetails.batch], + allowed_branch__contains=[studentDetails.branch], + deadline_datetime__gte=datetime.datetime.now(), + offer_accepted=True, + email_verified=True + ).order_by('deadline_datetime') + filtered_internships = internship_eligibility_filters(studentDetails, internships) internshipsdata = InternshipSerializerForStudent(filtered_internships, many=True).data diff --git a/CDC_Backend/APIs/utils.py b/CDC_Backend/APIs/utils.py index af106ad..9fe9951 100644 --- a/CDC_Backend/APIs/utils.py +++ b/CDC_Backend/APIs/utils.py @@ -286,9 +286,9 @@ def InternshipApplicationConditions(student, internship): return False, "You have already secured a Internship" if student.degree not in internship.eligiblestudents: raise PermissionError("Can't apply for this Internship") - if student.branch not in internship.allowed_branch: + if student.degree != 'BSMS' and student.branch not in internship.allowed_branch: # for BSMS branch is not considered raise PermissionError("Can't apply for this Internship") - if student.degree == 'bTech' and student.batch not in internship.allowed_batch: + if student.degree == bTech and student.batch not in internship.allowed_batch: raise PermissionError("Can't apply for this Internship") if student.can_apply_internship == False: raise PermissionError("Can't apply for this Internship")