Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in Allot Courses Function #1681

Merged
merged 3 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions FusionIIIT/applications/academic_procedures/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
# demo_date = demo_date + datetime.timedelta(days = 180)
# demo_date = demo_date + datetime.timedelta(days = 3)
# demo_date = demo_date - datetime.timedelta(days = 5)
user_sem=0
student_status = None
hod_status = None
account_status = None
Expand Down Expand Up @@ -367,7 +368,8 @@ def academic_procedures_student(request):

try:
semester_no = obj.curr_semester_no
next_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = semester_no)
sem_no=semester_no+1
next_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = sem_no)
user_sem = semester_no

except Exception as e:
Expand Down Expand Up @@ -1617,6 +1619,7 @@ def final_registration(request):
else:
return HttpResponseRedirect('/academic-procedures/main')


def allot_courses(request):
if user_check(request):
return HttpResponseRedirect('/academic-procedures/main')
Expand All @@ -1627,6 +1630,7 @@ def allot_courses(request):
profiles=request.FILES['allotedCourses']
batch_id=request.POST['batch']
sem_no=int(request.POST['semester'])
working_year =int(request.POST['working_year'])

batch=Batch.objects.get(id=batch_id)
sem_id=Semester.objects.get(curriculum=batch.curriculum,semester_no=sem_no)
Expand All @@ -1652,8 +1656,14 @@ def allot_courses(request):
user_info = ExtraInfo.objects.get(user=user)
student = Student.objects.get(id=user_info)
course_slot=CourseSlot.objects.get(name=course_slot_name.strip(),semester=sem_id)
print(course_code.strip() , course_name.strip())
course = Courses.objects.get(code=course_code.strip(),name=course_name.strip())
slot_courses = course_slot.courses.filter()
# for i in slot_courses:
# print("slot course ", i)
# print(course_slot)
print(course_code.strip() , course_name.strip(),student)
course = slot_courses.get(code=course_code.strip())
# print(course_code.strip() , course_name.strip(),student)
# course = Courses.objects.get(code=course_code.strip(),name=course_name.strip())
if(roll_no not in currroll):
student_check=StudentRegistrationChecks(student_id = student, semester_id = sem_id, pre_registration_flag = True,final_registration_flag = True)
student_checks.append(student_check)
Expand All @@ -1668,7 +1678,7 @@ def allot_courses(request):
course_id=course,semester_id=sem_id, verified=True )
final_registrations.append(final_registration)

courseregistration=course_registration(working_year=datetime.datetime.now().year,course_id=course,semester_id=sem_id,student_id=student,course_slot_id=course_slot)
courseregistration=course_registration(working_year=working_year,course_id=course,semester_id=sem_id,student_id=student,course_slot_id=course_slot)
course_registrations.append(courseregistration)


Expand All @@ -1693,8 +1703,6 @@ def allot_courses(request):





@login_required
def user_check(request):
"""
Expand Down Expand Up @@ -2249,7 +2257,7 @@ def acad_person(request):
def acad_proced_global_context():
year = demo_date.year
month = demo_date.month
yearr = str(year) + "-" + str(year+1)
yearr = get_acad_year(user_sem,year)
semflag = 0
queryflag = 0
query_option1 = get_batch_query_detail(month, year)
Expand Down
5 changes: 5 additions & 0 deletions FusionIIIT/templates/academic_procedures/allot_courses.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ <h4 class="ui dividing header"><a href="../media/Administrator/academic_procedur
<option value="8" class="sem">8</option>
</select>
</div>
<div class="field">
<label>Working Year</label>
<input type="number" id="working_year" name="working_year" required="true">

</div>

<div class="field">
<input type="file" name="allotedCourses" required
Expand Down
Loading