Skip to content

Commit 52d734e

Browse files
authored
Merge pull request #1839 from vikrantwiz02/prod/acad-react
Updated Upcoming Batches Related Code Files
2 parents e32d293 + eb5d63d commit 52d734e

File tree

6 files changed

+552
-126
lines changed

6 files changed

+552
-126
lines changed

FusionIIIT/applications/academic_procedures/api/views.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3599,6 +3599,24 @@ def apply_batch_changes(request):
35993599
student.batch_id = new_batch
36003600
student.batch = nyear
36013601
student.save()
3602+
3603+
# Sync branch, department, and specialization
3604+
try:
3605+
from applications.programme_curriculum.models_student_management import StudentBatchUpload
3606+
from applications.globals.models import DepartmentInfo
3607+
student_upload = StudentBatchUpload.objects.filter(roll_number=student.id_id).first()
3608+
if student_upload:
3609+
student_upload.branch = new_batch.discipline.name
3610+
student_upload.save()
3611+
dept_name = new_batch.discipline.acronym
3612+
department = DepartmentInfo.objects.filter(name=dept_name).first()
3613+
if department:
3614+
student.id.department = department
3615+
student.id.save()
3616+
student.specialization = dept_name
3617+
student.save()
3618+
except:
3619+
pass
36023620

36033621
if errors:
36043622
return Response({"errors": errors}, status=status.HTTP_207_MULTI_STATUS)

FusionIIIT/applications/programme_curriculum/api/serializers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from rest_framework import serializers
22
from applications.programme_curriculum.models import Programme, Discipline, Curriculum, Semester, Course, Batch, CourseSlot, CourseInstructor
3+
from applications.programme_curriculum.models_student_management import StudentBatchUpload
34

45
# this is for Programme model ....
56

@@ -122,3 +123,8 @@ class ProgrammePostSerializer(serializers.ModelSerializer):
122123
class Meta:
123124
model = Programme
124125
fields = ['id', 'category', 'name', 'programme_begin_year']
126+
127+
class StudentBatchUploadSerializer(serializers.ModelSerializer):
128+
class Meta:
129+
model = StudentBatchUpload
130+
fields = '__all__'

0 commit comments

Comments
 (0)