Skip to content

Commit 3ea154d

Browse files
authored
Merge pull request #1872 from vikrantwiz02/prod/acad-react
fix: update course registration logic to handle previous graded courses
2 parents 2fa8c13 + 6a15c46 commit 3ea154d

File tree

1 file changed

+14
-3
lines changed
  • FusionIIIT/applications/examination/api

1 file changed

+14
-3
lines changed

FusionIIIT/applications/examination/api/views.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3787,17 +3787,28 @@ def post(self, request):
37873787
semester_type=semester_type,
37883788
).select_related('course_id')
37893789

3790-
substituted_ids = set(
3790+
swayam_reg_ids = set(
37913791
course_replacement.objects.filter(
37923792
new_course_registration__in=student_regs
37933793
).values_list('new_course_registration_id', flat=True)
37943794
)
37953795

3796+
prev_graded_course_ids = set(
3797+
Student_grades.objects.filter(
3798+
roll_no=student_id,
3799+
semester__lt=semester_number,
3800+
)
3801+
.exclude(grade__isnull=True)
3802+
.exclude(grade='')
3803+
.values_list('course_id', flat=True)
3804+
)
3805+
37963806
for creg in student_regs:
37973807
cid = creg.course_id.id
3798-
if creg.id in substituted_ids:
3808+
course_code = (creg.course_id.code or '').upper()
3809+
if creg.id in swayam_reg_ids and course_code.startswith('SW'):
37993810
course_reg_map[cid] = 'S'
3800-
elif creg.registration_type in ('Backlog', 'Improvement'):
3811+
elif cid in prev_graded_course_ids:
38013812
course_reg_map[cid] = 'R'
38023813
except Exception:
38033814
pass

0 commit comments

Comments
 (0)