From 922bb824fedb791f73bab47641a30e836d76a558 Mon Sep 17 00:00:00 2001 From: grvup Date: Wed, 23 Oct 2024 10:02:56 +0530 Subject: [PATCH 1/4] fix: resolved migrations error --- .../migrations/0002_auto_20241021_0331.py | 37 ------------------- ...020_1126.py => 0002_auto_20241023_1002.py} | 21 ++++++++++- 2 files changed, 20 insertions(+), 38 deletions(-) delete mode 100644 FusionIIIT/applications/online_cms/migrations/0002_auto_20241021_0331.py rename FusionIIIT/applications/online_cms/migrations/{0002_auto_20241020_1126.py => 0002_auto_20241023_1002.py} (68%) diff --git a/FusionIIIT/applications/online_cms/migrations/0002_auto_20241021_0331.py b/FusionIIIT/applications/online_cms/migrations/0002_auto_20241021_0331.py deleted file mode 100644 index 0a441f642..000000000 --- a/FusionIIIT/applications/online_cms/migrations/0002_auto_20241021_0331.py +++ /dev/null @@ -1,37 +0,0 @@ -# Generated by Django 3.1.5 on 2024-10-21 03:31 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('online_cms', '0001_initial'), - ] - - operations = [ - migrations.RemoveField( - model_name='student_grades', - name='total_marks', - ), - migrations.AddField( - model_name='student_grades', - name='remarks', - field=models.CharField(max_length=500, null=True), - ), - migrations.AddField( - model_name='student_grades', - name='verified', - field=models.BooleanField(default=False), - ), - migrations.AlterField( - model_name='attendance', - name='present', - field=models.IntegerField(default=0), - ), - migrations.AlterField( - model_name='gradingscheme', - name='type_of_evaluation', - field=models.CharField(max_length=100), - ), - ] diff --git a/FusionIIIT/applications/online_cms/migrations/0002_auto_20241020_1126.py b/FusionIIIT/applications/online_cms/migrations/0002_auto_20241023_1002.py similarity index 68% rename from FusionIIIT/applications/online_cms/migrations/0002_auto_20241020_1126.py rename to FusionIIIT/applications/online_cms/migrations/0002_auto_20241023_1002.py index 2e166954c..659201064 100644 --- a/FusionIIIT/applications/online_cms/migrations/0002_auto_20241020_1126.py +++ b/FusionIIIT/applications/online_cms/migrations/0002_auto_20241023_1002.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2024-10-20 11:26 +# Generated by Django 3.1.5 on 2024-10-23 10:02 from django.db import migrations, models import django.db.models.deletion @@ -12,11 +12,30 @@ class Migration(migrations.Migration): ] operations = [ + migrations.RemoveField( + model_name='student_grades', + name='total_marks', + ), migrations.AddField( model_name='attendance', name='no_of_attendance', field=models.IntegerField(default=1), ), + migrations.AddField( + model_name='student_grades', + name='reSubmit', + field=models.BooleanField(default=True), + ), + migrations.AddField( + model_name='student_grades', + name='remarks', + field=models.CharField(max_length=500, null=True), + ), + migrations.AddField( + model_name='student_grades', + name='verified', + field=models.BooleanField(default=False), + ), migrations.AlterField( model_name='attendance', name='present', From 2d723e470e1a2708690599f4573aa6cf42cae265 Mon Sep 17 00:00:00 2001 From: grvup Date: Sun, 3 Nov 2024 02:00:54 +0530 Subject: [PATCH 2/4] AC-1 bug fix --- FusionIIIT/applications/programme_curriculum/forms.py | 4 +++- FusionIIIT/applications/programme_curriculum/views.py | 6 +++--- .../programme_curriculum/acad_admin/course_form.html | 5 +++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/FusionIIIT/applications/programme_curriculum/forms.py b/FusionIIIT/applications/programme_curriculum/forms.py index 38d6b9e11..667178582 100644 --- a/FusionIIIT/applications/programme_curriculum/forms.py +++ b/FusionIIIT/applications/programme_curriculum/forms.py @@ -174,6 +174,7 @@ class Meta: 'percent_project' : forms.NumberInput(attrs={'placeholder': '%'}, ), 'percent_lab_evaluation' : forms.NumberInput(attrs={'placeholder': '%'}, ), 'percent_course_attendance' : forms.NumberInput(attrs={'placeholder': '%'}, ), + 'max_seats' : forms.NumberInput(attrs={'placeholder': 'max_seats',}, ), } labels = { 'code' : 'Course Code', @@ -197,7 +198,8 @@ class Meta: 'percent_lab_evaluation' : 'percent_lab_evaluation', 'percent_course_attendance' : 'percent_course_attendance', 'working_course' : 'working_course', - 'disciplines' : 'disciplines' + 'disciplines' : 'disciplines', + 'max_seats' : 'max_seats' } diff --git a/FusionIIIT/applications/programme_curriculum/views.py b/FusionIIIT/applications/programme_curriculum/views.py index dda6eeb38..a7ba330a7 100644 --- a/FusionIIIT/applications/programme_curriculum/views.py +++ b/FusionIIIT/applications/programme_curriculum/views.py @@ -845,7 +845,7 @@ def update_course_form(request, course_id): ver=0 if(new_course.version>previous.version): # Check if a course with the same values (except version, latest_version, disciplines, and pre_requisit_courses) already exists - old_course=Course.objects.filter(code=new_course.code, name=new_course.name, credit=new_course.credit, lecture_hours=new_course.lecture_hours, tutorial_hours=new_course.tutorial_hours, pratical_hours=new_course.pratical_hours, discussion_hours=new_course.discussion_hours, project_hours=new_course.project_hours, pre_requisits=new_course.pre_requisits, syllabus=new_course.syllabus, percent_quiz_1=new_course.percent_quiz_1, percent_midsem=new_course.percent_midsem, percent_quiz_2=new_course.percent_quiz_2, percent_endsem=new_course.percent_endsem, percent_project=new_course.percent_project, percent_lab_evaluation=new_course.percent_lab_evaluation, percent_course_attendance=new_course.percent_course_attendance, ref_books=new_course.ref_books) + old_course=Course.objects.filter(code=new_course.code, name=new_course.name, credit=new_course.credit, lecture_hours=new_course.lecture_hours, tutorial_hours=new_course.tutorial_hours, pratical_hours=new_course.pratical_hours, discussion_hours=new_course.discussion_hours, project_hours=new_course.project_hours, pre_requisits=new_course.pre_requisits, syllabus=new_course.syllabus, percent_quiz_1=new_course.percent_quiz_1, percent_midsem=new_course.percent_midsem, percent_quiz_2=new_course.percent_quiz_2, percent_endsem=new_course.percent_endsem, percent_project=new_course.percent_project, percent_lab_evaluation=new_course.percent_lab_evaluation, percent_course_attendance=new_course.percent_course_attendance, ref_books=new_course.ref_books,max_seats=new_course.max_seats) if old_course: # Check if disciplines or pre_requisit_courses have been changed for i in old_course: @@ -1657,7 +1657,7 @@ def add_course_instructor(request): form = CourseInstructorForm(request.POST) if form.is_valid(): form.save() # Save the form data to the database - return redirect('/programme_curriculum/') # Redirect to a success page after saving + return redirect('/programme_curriculum/admin_instructor/') # Redirect to a success page after saving else: form = CourseInstructorForm() @@ -1692,7 +1692,7 @@ def update_course_instructor_form(request, instructor_id): form = CourseInstructorForm(request.POST, instance=course_instructor) if form.is_valid(): form.save() # Save the updated data to the database - return redirect('/programme_curriculum/') # Redirect after successful update + return redirect('/programme_curriculum/admin_instructor/') # Redirect after successful update else: # Create the form with existing data (pre-populated) form = CourseInstructorForm(instance=course_instructor) diff --git a/FusionIIIT/templates/programme_curriculum/acad_admin/course_form.html b/FusionIIIT/templates/programme_curriculum/acad_admin/course_form.html index aeb2779df..a45b5843f 100644 --- a/FusionIIIT/templates/programme_curriculum/acad_admin/course_form.html +++ b/FusionIIIT/templates/programme_curriculum/acad_admin/course_form.html @@ -189,6 +189,11 @@ {{ form.percent_course_attendance }} +
+ + + {{ form.max_seats }} +
From 35d0762813477f625744dcefb35d1ca5bb0d76ec Mon Sep 17 00:00:00 2001 From: grvup Date: Fri, 8 Nov 2024 10:30:00 +0530 Subject: [PATCH 3/4] changes done in ac-2 --- .../academic_information/utils.py | 43 ++++++++++++++++--- .../academic_information/views.py | 4 +- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/FusionIIIT/applications/academic_information/utils.py b/FusionIIIT/applications/academic_information/utils.py index 77323538a..63b5d6a0f 100644 --- a/FusionIIIT/applications/academic_information/utils.py +++ b/FusionIIIT/applications/academic_information/utils.py @@ -34,7 +34,7 @@ def check_for_registration_complete (request): if date>=prd_start_date and date<=prd_end_date: return JsonResponse({'status':-1 , "message":"registration is under process"}) - if course_registration.objects.filter(Q(semester_id__semester_no = sem) & Q(student_id__batch = batch)).exists() : + if FinalRegistration.objects.filter(Q(semester_id__semester_no = sem) & Q(student_id__batch = batch)).exists() : return JsonResponse({'status':2,"message":"courses already allocated"}) return JsonResponse({"status":1 , "message" : "courses not yet allocated"}) @@ -78,9 +78,9 @@ def random_algo(batch,sem,year,course_slot) : course_object = Course.objects.get(id=course) course_slot_object = CourseSlot.objects.get(id = random_student_selected[1]) semester_object = Semester.objects.get(Q(semester_no = sem) & Q(curriculum = curriculum_object)) - course_registration.objects.create( + FinalRegistration.objects.create( student_id = stud, - working_year = year, + verified=False, semester_id = semester_object, course_id = course_object, course_slot_id = course_slot_object @@ -107,7 +107,38 @@ def allocate(request) : with transaction.atomic() : for course_slot in unique_course_slot : course_slot_object = CourseSlot.objects.get(id=course_slot) - if course_slot_object.type == "Open Elective": # Runs only for open elective course slots + print(course_slot_object) + if course_slot_object.type != "Open Elective": + # Fetch students registered in this course slot + students = InitialRegistration.objects.filter( + Q(semester_id__semester_no=sem) & + Q(course_slot_id=course_slot_object) & + Q(student_id__batch=batch) + ).values_list('student_id', flat=True) + + # Allocate each student directly to FinalRegistration + for student_id in students: + student = Student.objects.get(id=student_id) + semester = Semester.objects.get(semester_no=sem, curriculum=student.batch_id.curriculum) + print(semester.id) + # course = Course.objects.get(id=course_slot_object.courses.id) + course_id = course_slot_object.courses.values_list('id', flat=True).first() + # Retrieve the Course instance + course = Course.objects.get(id=course_id) + print(course) + print(student) + print(course_slot_object) + # Insert directly into FinalRegistration + FinalRegistration.objects.create( + student_id=student, + verified=False, + semester_id=semester, + course_id=course, + course_slot_id=course_slot_object + ) + print("gaurav") + unique_course_name.append(course_slot_object.name) + elif course_slot_object.type == "Open Elective": # Runs only for open elective course slots if course_slot_object.name not in unique_course_name: stat = random_algo(batch,sem,year,course_slot_object.name) unique_course_name.append(course_slot_object.name) @@ -122,10 +153,10 @@ def allocate(request) : def view_alloted_course(request) : batch = request.POST.get('batch') sem = request.POST.get('sem') - year = request.POST.get('year') + verified = request.POST.get('year') course = request.POST.get('course') - registrations = course_registration.objects.filter(Q(student_id__batch = batch) & Q(working_year = year) & Q(semester_id__semester_no = sem) & Q(course_id__code = course)) + registrations = FinalRegistration.objects.filter(Q(student_id__batch = batch) & Q(verified = False) & Q(semester_id__semester_no = sem) & Q(course_id__code = course)) return_list = [] for registration in registrations: obj = { diff --git a/FusionIIIT/applications/academic_information/views.py b/FusionIIIT/applications/academic_information/views.py index 021214732..b1b643198 100755 --- a/FusionIIIT/applications/academic_information/views.py +++ b/FusionIIIT/applications/academic_information/views.py @@ -17,7 +17,7 @@ from django.template.loader import render_to_string from django.contrib.auth.decorators import login_required -from applications.academic_procedures.models import MinimumCredits, Register, InitialRegistration, course_registration, AssistantshipClaim,Assistantship_status +from applications.academic_procedures.models import MinimumCredits, Register, InitialRegistration, course_registration, AssistantshipClaim,Assistantship_status,FinalRegistration from applications.globals.models import (Designation, ExtraInfo, HoldsDesignation, DepartmentInfo) @@ -1156,7 +1156,7 @@ def get_excel(request): sem = request.POST.get('semester-check-view') year = request.POST.get('year-check-view') course = request.POST.get('Course-check-view') - registrations = course_registration.objects.filter(Q(student_id__batch = batch) & Q(working_year = year) & Q(semester_id__semester_no = sem) & Q(course_id__code = course)) + registrations = FinalRegistration.objects.filter(Q(student_id__batch = batch) & Q(verified = False) & Q(semester_id__semester_no = sem) & Q(course_id__code = course)) return_list = [] for registration in registrations: return_list.append(registration.student_id.id.id) From bed7f0e8a6c7bd27e3d1fcd8954d495f43d05d03 Mon Sep 17 00:00:00 2001 From: grvup Date: Fri, 8 Nov 2024 12:19:36 +0530 Subject: [PATCH 4/4] minor changes --- FusionIIIT/applications/academic_information/utils.py | 8 +++----- FusionIIIT/applications/academic_information/views.py | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/FusionIIIT/applications/academic_information/utils.py b/FusionIIIT/applications/academic_information/utils.py index 63b5d6a0f..325e7c1b0 100644 --- a/FusionIIIT/applications/academic_information/utils.py +++ b/FusionIIIT/applications/academic_information/utils.py @@ -125,9 +125,7 @@ def allocate(request) : course_id = course_slot_object.courses.values_list('id', flat=True).first() # Retrieve the Course instance course = Course.objects.get(id=course_id) - print(course) - print(student) - print(course_slot_object) + # Insert directly into FinalRegistration FinalRegistration.objects.create( student_id=student, @@ -136,7 +134,7 @@ def allocate(request) : course_id=course, course_slot_id=course_slot_object ) - print("gaurav") + unique_course_name.append(course_slot_object.name) elif course_slot_object.type == "Open Elective": # Runs only for open elective course slots if course_slot_object.name not in unique_course_name: @@ -156,7 +154,7 @@ def view_alloted_course(request) : verified = request.POST.get('year') course = request.POST.get('course') - registrations = FinalRegistration.objects.filter(Q(student_id__batch = batch) & Q(verified = False) & Q(semester_id__semester_no = sem) & Q(course_id__code = course)) + registrations = FinalRegistration.objects.filter(Q(student_id__batch = batch) & Q(semester_id__semester_no = sem) & Q(course_id__code = course)) return_list = [] for registration in registrations: obj = { diff --git a/FusionIIIT/applications/academic_information/views.py b/FusionIIIT/applications/academic_information/views.py index b1b643198..2df3833b2 100755 --- a/FusionIIIT/applications/academic_information/views.py +++ b/FusionIIIT/applications/academic_information/views.py @@ -1156,7 +1156,7 @@ def get_excel(request): sem = request.POST.get('semester-check-view') year = request.POST.get('year-check-view') course = request.POST.get('Course-check-view') - registrations = FinalRegistration.objects.filter(Q(student_id__batch = batch) & Q(verified = False) & Q(semester_id__semester_no = sem) & Q(course_id__code = course)) + registrations = FinalRegistration.objects.filter(Q(student_id__batch = batch) & Q(semester_id__semester_no = sem) & Q(course_id__code = course)) return_list = [] for registration in registrations: return_list.append(registration.student_id.id.id)