From 33ab8e71e2b525dd690e1de93252551b2f964ee2 Mon Sep 17 00:00:00 2001 From: vikrantwiz02 Date: Thu, 25 Dec 2025 10:04:55 +0530 Subject: [PATCH] Refactor student_list_requests to retrieve academic year and semester type from course registration if available --- FusionIIIT/applications/academic_procedures/api/views.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/FusionIIIT/applications/academic_procedures/api/views.py b/FusionIIIT/applications/academic_procedures/api/views.py index 2f08bb6e9..b1d8a5ad2 100644 --- a/FusionIIIT/applications/academic_procedures/api/views.py +++ b/FusionIIIT/applications/academic_procedures/api/views.py @@ -2933,7 +2933,14 @@ def student_list_requests(request): current_user = request.user user_details = current_user.extrainfo student = Student.objects.get(id=user_details) - academic_year, semester_type = generate_current_session(datetime.datetime.now().year, student.curr_semester_no) + current_reg = course_registration.objects.filter(student_id=student, semester_id__semester_no=student.curr_semester_no).first() + + if current_reg: + academic_year = current_reg.session + semester_type = current_reg.semester_type + else: + academic_year, semester_type = generate_current_session(datetime.datetime.now().year, student.curr_semester_no) + qs = CourseReplacementRequest.objects.filter(student=student, academic_year=academic_year, semester_type = semester_type).order_by('-created_at') out = [] for r in qs: