From 73d046da70e7a81632ce07d68081cced0f824f83 Mon Sep 17 00:00:00 2001 From: Vikrant Date: Fri, 18 Sep 2026 00:31:17 +0530 Subject: [PATCH] Also clean up main academic tables when withdrawing a reported student update_student_status only removed the ExtraInfo/Student/User rows it had created on REPORTED when the new status was NOT_REPORTED or PENDING, so a student withdrawn after being reported kept a stale Student row behind. That stale row made verify_course treat them as an active student with zero registered courses instead of returning the WITHDRAWAL status error. --- .../programme_curriculum/api/views_student_management.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/FusionIIIT/applications/programme_curriculum/api/views_student_management.py b/FusionIIIT/applications/programme_curriculum/api/views_student_management.py index c87e90f5b..04ea389d0 100644 --- a/FusionIIIT/applications/programme_curriculum/api/views_student_management.py +++ b/FusionIIIT/applications/programme_curriculum/api/views_student_management.py @@ -2435,8 +2435,7 @@ def update_student_status(request): except Exception as e: transfer_message = f"Status updated but transfer failed: {str(e)}" - # REVERT: Remove from main tables when status becomes NOT_REPORTED - elif reported_status in ['NOT_REPORTED', 'PENDING'] and old_status == 'REPORTED': + elif reported_status in ['NOT_REPORTED', 'PENDING', 'WITHDRAWAL'] and old_status == 'REPORTED': try: from applications.globals.models import ExtraInfo from applications.academic_information.models import Student as AcademicStudent @@ -2533,7 +2532,7 @@ def update_student_status(request): # Prepare descriptive response message if reported_status == 'REPORTED' and old_status != 'REPORTED': main_message = f'Student status updated to {reported_status} and transferred to main academic system' - elif reported_status in ['NOT_REPORTED', 'PENDING'] and old_status == 'REPORTED': + elif reported_status in ['NOT_REPORTED', 'PENDING', 'WITHDRAWAL'] and old_status == 'REPORTED': main_message = f'Student status reverted to {reported_status} and removed from main academic system' else: main_message = f'Student status updated to {reported_status}'