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

chore(Release): Dashboard Client sync with Latest Staging #1659

Merged
merged 68 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
38ba63e
fix: Resolved System check errors on latest_staging
ramG-reddy Oct 20, 2024
f4e062c
chore: migrations for previous commit changes
ramG-reddy Oct 20, 2024
014a47d
Required changes in forms.py
grvup Oct 20, 2024
415d2fd
Required changes in views and template files
younome71 Oct 20, 2024
085d2fa
Merge branch 'ac-1-changes' into latest_staging
grvup Oct 20, 2024
7a9d5f0
changed files in templates
grvup Oct 20, 2024
4b11e9e
Merge pull request #1632 from grvup/latest_staging
dvjsharma Oct 21, 2024
891ac5c
Changed Template Files: Co authored by Abhyuday Singh and Arghadeep Bosu
arghaDEVIL Oct 21, 2024
792aa18
Configured Backend: Added new feature in Examination module and modif…
Lone24wolf Oct 21, 2024
463b839
added migration file for the attributes changed in online_cms module
Lone24wolf Oct 21, 2024
fc87af7
added dean actor and gave verification powers only to dean and not to…
Lone24wolf Oct 21, 2024
d4da4bd
feat(AC2): Added support for elective preregistration and corrected p…
Akashsah2003 Oct 21, 2024
7d72e85
Examination Module completed: Dean academic added, resubmission power…
Lone24wolf Oct 21, 2024
a6438bc
AC-7 module feature requests (#1634)
Lone24wolf Oct 22, 2024
9b31585
Merge pull request #1633 from Akashsah2003/latest_staging
dvjsharma Oct 22, 2024
922bb82
fix: resolved migrations error
grvup Oct 23, 2024
b2612e2
fix: resolved migrations error
grvup Oct 23, 2024
81a308d
Merge remote-tracking branch 'upstream/latest_staging' into ac-7-exam…
Lone24wolf Oct 23, 2024
080a9a3
Created Validation Page for Dean
Lone24wolf Oct 23, 2024
f8c95af
kuldeep's suggestions
Lone24wolf Oct 23, 2024
e792eb1
Merge pull request #1638 from Lone24wolf/ac-7-examination
dvjsharma Oct 23, 2024
a9b48d3
Bugs fixed in redirecting of pages
Lone24wolf Oct 23, 2024
f54d7b1
Merge pull request #1639 from Lone24wolf/ac-7-examination
dvjsharma Oct 23, 2024
c0bc007
implemented logic for adding course Instructor to courses
grvup Oct 23, 2024
0c55dfc
feat[ac-1]: implemented logic for updating course instructor
grvup Oct 23, 2024
0e6b1f0
AC-2 essential changes (#1640)
ramG-reddy Oct 24, 2024
e6a68a6
Merge remote-tracking branch 'upstream/latest_staging' into latest_st…
grvup Nov 2, 2024
2d723e4
AC-1 bug fix
grvup Nov 2, 2024
18b8792
AC-1 bug fix (#1642)
grvup Nov 4, 2024
83f136a
Changed Optional Elective to Open Elective in pre registration
Akashsah2003 Nov 4, 2024
c97c5b4
Merge pull request #1643 from Akashsah2003/latest_staging
dvjsharma Nov 4, 2024
c1c6832
feat(AC2): Removed minimum credits requirement to submit preregistrat…
Akashsah2003 Nov 4, 2024
e91aeee
Merge pull request #1644 from Akashsah2003/latest_staging
dvjsharma Nov 4, 2024
9edea5a
Merge remote-tracking branch 'upstream/latest_staging' into latest_st…
grvup Nov 5, 2024
e524982
Corrections for open ellective allocation
ChallaBharadwajReddy Nov 6, 2024
f9d17b7
Merge pull request #1645 from ChallaBharadwajReddy/latest_staging
dvjsharma Nov 6, 2024
8c1fec7
Merge remote-tracking branch 'upstream/latest_staging' into latest_st…
grvup Nov 6, 2024
35d0762
changes done in ac-2
grvup Nov 8, 2024
bed7f0e
minor changes
grvup Nov 8, 2024
1482d34
Merge pull request #1646 from grvup/latest_staging
dvjsharma Nov 8, 2024
7e8d3ff
fix(AC2): Fixed message shown after pre registration window closes.
Akashsah2003 Nov 9, 2024
c022d86
Merge pull request #1648 from Akashsah2003/latest_staging
dvjsharma Nov 9, 2024
b79072a
feat(AC1 & AC2): Added search functionality in fields of course instr…
grvup Nov 10, 2024
bed30ed
Merge pull request #1649 from grvup/latest_staging
dvjsharma Nov 10, 2024
e3bf90c
feat(AC-1): updated courseinstructor table
grvup Nov 15, 2024
1a80462
Merge pull request #1650 from grvup/latest_staging
dvjsharma Nov 15, 2024
6e90e6c
filtering by working year added in examination
Lone24wolf Nov 15, 2024
947f177
pdf generation for faculty
HrxSrv Nov 16, 2024
a3f6dc0
Merge remote-tracking branch 'upstream/latest_staging' into ac-7-exam…
Lone24wolf Nov 16, 2024
83b37ef
fix(registration): Integrated backlog part in the process
Akashsah2003 Nov 16, 2024
90745a6
Merge pull request #1651 from Akashsah2003/latest_staging
dvjsharma Nov 16, 2024
3f78617
Bug fix (#1652)
grvup Nov 17, 2024
4343f08
fix(academic): Removed Manage button for courses.
Akashsah2003 Nov 17, 2024
2e45036
Merge pull request #1653 from Akashsah2003/latest_staging
ramG-reddy Nov 17, 2024
248ece7
Merge remote-tracking branch 'upstream/latest_staging' into ac-7-exam…
Lone24wolf Nov 17, 2024
0133a00
feat: Added session expired logout feature
Pratik2026 Nov 17, 2024
1c816b8
added batchwise result generation
Lone24wolf Nov 18, 2024
425a0bc
feat(pre-registration): Added delete pre registration data functional…
Akashsah2003 Nov 19, 2024
c5d662e
Merge pull request #1655 from Akashsah2003/latest_staging
dvjsharma Nov 19, 2024
1ad828d
Merge pull request #1654 from Pratik2026/gad-5
dvjsharma Nov 19, 2024
c4df1b3
added columns in excel sheet and changed the template for grade submi…
Lone24wolf Nov 20, 2024
6a5fd4a
bug fixes
Lone24wolf Nov 20, 2024
f670d7d
generate pdf completed and bug fixes
HrxSrv Nov 22, 2024
c2929e2
Merge remote-tracking branch 'upstream/latest_staging' into ac-7-exam…
Lone24wolf Nov 22, 2024
90b36de
Merge pull request #1658 from Lone24wolf/ac-7-examination
dvjsharma Nov 22, 2024
6f93748
Configurations for Fusion-client (#1628)
ramG-reddy Oct 7, 2024
9922224
fix: Resolved System Check errors (#1630)
ramG-reddy Oct 14, 2024
fa3cdd5
Resolved Major bug and also added username field in auth data (#1635)
Pratik2026 Oct 22, 2024
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
5 changes: 5 additions & 0 deletions FusionIIIT/Fusion/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,8 @@

CORS_ORIGIN_ALLOW_ALL = True
ALLOW_PASS_RESET = True

# session settings
SESSION_COOKIE_AGE = 15 * 60
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_SAVE_EVERY_REQUEST = True
14 changes: 13 additions & 1 deletion FusionIIIT/applications/academic_information/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django import forms

from .models import Exam_timetable, Meeting, Timetable
from .models import Exam_timetable, Meeting, Timetable, Student


class MinuteForm(forms.ModelForm):
Expand Down Expand Up @@ -49,3 +49,15 @@ class ExamTimetableForm(forms.ModelForm):
class Meta:
model = Exam_timetable
fields = ('programme', 'exam_time_table',)


class PreRegistrationSearchForm(forms.Form):
roll_no = forms.CharField(
max_length=20,
widget=forms.TextInput(attrs={'class': 'ui input', 'placeholder': 'Enter Roll Number'}),
label="Roll Number"
)
semester_no = forms.IntegerField(
widget=forms.NumberInput(attrs={'class': 'ui input', 'placeholder': 'Enter Semester No'}),
label="Semester No"
)
1 change: 1 addition & 0 deletions FusionIIIT/applications/academic_information/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@
url(r'^api/',include('applications.academic_information.api.urls')),
url(r'^view_all_student_data', views.view_all_student_data, name='view_all_student_data'),
url(r'^generateStudentSheet$',views.generatestudentxlsheet, name = 'generatestudentxlsheet'),
url(r'^course_allocated_students$',views.get_excel, name = 'course_allocated_students'),
]
165 changes: 165 additions & 0 deletions FusionIIIT/applications/academic_information/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
from applications.academic_information.models import (Calendar, Student,Curriculum_Instructor, Curriculum,
Student_attendance)
from ..academic_procedures.models import (BranchChange, CoursesMtech, InitialRegistration, StudentRegistrationChecks,
Register, Thesis, FinalRegistration, ThesisTopicProcess,
Constants, FeePayments, TeachingCreditRegistration, SemesterMarks,
MarkSubmissionCheck, Dues,AssistantshipClaim, MTechGraduateSeminarReport,
PhDProgressExamination,CourseRequested, course_registration, MessDue, Assistantship_status , backlog_course,)

from applications.programme_curriculum.models import(Course,CourseSlot,Batch,Semester)
from django.http import HttpResponse, JsonResponse
from django.utils import timezone
from django.core import serializers
from django.db.models import Q
import datetime
import random
from django.db import transaction
time = timezone.now()
def check_for_registration_complete (request):
batch = int(request.POST.get('batch'))
sem = int(request.POST.get('sem'))
year = request.POST.get('year')


date = time.date()

try:

pre_registration_date = Calendar.objects.all().filter(description=f"Pre Registration {sem} {year}").first()
prd_start_date = pre_registration_date.from_date
prd_end_date = pre_registration_date.to_date

if date<prd_start_date :
return JsonResponse({'status':-2 , 'message': "registration didn't start"})
if date>=prd_start_date and date<=prd_end_date:
return JsonResponse({'status':-1 , "message":"registration is under process"})

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"})
except :
return JsonResponse({"status":-3, "message" : "No such registration found"})

@transaction.atomic
def random_algo(batch,sem,year,course_slot) :
unique_course = InitialRegistration.objects.filter(Q(semester_id__semester_no = sem) & Q( course_slot_id__name = course_slot ) & Q(student_id__batch = batch)).values_list('course_id',flat=True).distinct()
max_seats={}
seats_alloted = {}
present_priority = {}
next_priority = {}
total_seats = 0
for course in unique_course :
max_seats[course] = Course.objects.get(id=course).max_seats
total_seats+=max_seats[course]
seats_alloted[course] = 0
present_priority[course] = []
next_priority[course] = []

priority_1 = InitialRegistration.objects.filter(Q(semester_id__semester_no = sem) & Q( course_slot_id__name = course_slot ) & Q(student_id__batch = batch) & Q(priority=1))
rem=len(priority_1)
if rem > total_seats :
return -1

for p in priority_1 :
present_priority[p.course_id.id].append([p.student_id.id.id,p.course_slot_id.id])
with transaction.atomic() :
p_priority = 1
while rem > 0 :
for course in present_priority :
while(len(present_priority[course])) :
random_student_selected = random.choice(present_priority[course])

present_priority[course].remove(random_student_selected)

if seats_alloted[course] < max_seats[course] :
stud = Student.objects.get(id__id = random_student_selected[0])
curriculum_object = Student.objects.get(id__id = random_student_selected[0]).batch_id.curriculum
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))
FinalRegistration.objects.create(
student_id = stud,
verified=False,
semester_id = semester_object,
course_id = course_object,
course_slot_id = course_slot_object
)
seats_alloted[course] += 1
rem-=1
else :
next = InitialRegistration.objects.get(Q(student_id__id__id = random_student_selected[0]) & Q( course_slot_id__name = course_slot ) & Q(semester_id__semester_no = sem) & Q(student_id__batch = batch) & Q(priority=p_priority+1))
next_priority[next.course_id.id].append([next.student_id.id.id,next.course_slot_id.id])
p_priority+=1
present_priority = next_priority
next_priority = {course : [] for course in unique_course}

return 1

@transaction.atomic
def allocate(request) :
batch = request.POST.get('batch')
sem = request.POST.get('sem')
year = request.POST.get('year')
unique_course_slot = InitialRegistration.objects.filter(Q(semester_id__semester_no = sem) & Q(student_id__batch = batch)).values('course_slot_id', 'registration_type').distinct()
unique_course_name = []
try:
with transaction.atomic() :
for entry in unique_course_slot :
course_slot_object = CourseSlot.objects.get(id=entry['course_slot_id'])
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)

# Insert directly into FinalRegistration
FinalRegistration.objects.create(
student_id=student,
verified=False,
semester_id=semester,
course_id=course,
course_slot_id=course_slot_object,
registration_type=entry['registration_type']
)

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)
if(stat == -1) :
print(course_slot_object.name)
raise Exception("seats not enough for course_slot"+str(course_slot_object.name))

return JsonResponse({'status': 1 , 'message' : "course allocation successful"})
except:
return JsonResponse({'status': -1 , 'message' : "seats not enough for some course_slot"})

def view_alloted_course(request) :
batch = request.POST.get('batch')
sem = request.POST.get('sem')
verified = request.POST.get('year')
course = request.POST.get('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 = {
'student':registration.student_id.id.id
}
return_list.append(obj)
return JsonResponse({'status':1 , 'student_list':return_list })
97 changes: 94 additions & 3 deletions FusionIIIT/applications/academic_information/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
from django.views.decorators.csrf import csrf_exempt
from django.template.loader import render_to_string
from django.contrib.auth.decorators import login_required
from django.contrib import messages

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, StudentRegistrationChecks
from applications.globals.models import (Designation, ExtraInfo,
HoldsDesignation, DepartmentInfo)

from .forms import AcademicTimetableForm, ExamTimetableForm, MinuteForm
from .forms import AcademicTimetableForm, ExamTimetableForm, MinuteForm, PreRegistrationSearchForm
from .models import (Calendar, Course, Exam_timetable, Grades, Curriculum_Instructor,Constants,
Meeting, Student, Student_attendance, Timetable,Curriculum)
from applications.programme_curriculum.models import (CourseSlot, Course as Courses, Batch, Semester, Programme, Discipline)
Expand All @@ -31,6 +32,7 @@
from applications.academic_procedures.views import acad_proced_global_context , get_sem_courses
from applications.programme_curriculum.models import Batch
from django.db.models import Q
from .utils import check_for_registration_complete,allocate,view_alloted_course


@login_required
Expand Down Expand Up @@ -128,6 +130,7 @@ def get_context(request):
assistant_flag =""
hod_flag = ""
account_flag = ""
PreRegistrationsrchform = PreRegistrationSearchForm()

for obj in assis_stat:
assistant_flag = obj.student_status
Expand Down Expand Up @@ -177,6 +180,7 @@ def get_context(request):
'hod_flag' : hod_flag,
'account_flag' : account_flag,
'notifications': notifs,
'preregistrationsrchform': PreRegistrationsrchform,
}

return context
Expand Down Expand Up @@ -214,8 +218,50 @@ def homepage(request):
"""
if user_check(request):
return HttpResponseRedirect('/academic-procedures/')

context = get_context(request)

if request.method == "POST":
if 'check_allocation' in request.POST :
return check_for_registration_complete(request)
if 'start_allocation' in request.POST :
return allocate(request)
if 'view_allocation' in request.POST :
return view_alloted_course(request)
if 'search_preregistration' in request.POST or 'delete_preregistration' in request.POST:
form = PreRegistrationSearchForm(request.POST)
if form.is_valid():
roll_no = form.cleaned_data['roll_no'].upper()
semester_no = form.cleaned_data['semester_no']
print(roll_no, semester_no)

# Fetch student object by roll number
# student = get_object_or_404(Student, id=roll_no)

# Fetch semester by semester number
# semester = get_object_or_404(Semester, semester_no=semester_no)
# print(f"Student -> {student}")

# Search for all initial registrations and student registration check
initial_registrations = InitialRegistration.objects.filter(
student_id_id=roll_no, semester_id__semester_no=semester_no
)
student_registration_check = StudentRegistrationChecks.objects.filter(
student_id_id=roll_no, semester_id__semester_no=semester_no
).first()
if ('delete_preregistration' in request.POST):
print(initial_registrations, student_registration_check)
try:
initial_registrations.delete()
student_registration_check.delete()
messages.success(request, "Student's pre registration data successfully deleted.")
except:
messages.error(request, "An error occured while deleting.")
context['delete_preregistration'] = True
else :
context['initial_registrations'] = initial_registrations
context['student_registration_check'] = student_registration_check
context['delete_preregistration'] = True

return render(request, "ais/ais.html", context)

Expand Down Expand Up @@ -1141,7 +1187,52 @@ def generate_preregistration_report(request):
st = 'attachment; filename = ' + batch.name + batch.discipline.acronym + str(batch.year) + '-preresgistration.xlsx'
response['Content-Disposition'] = st
return response

@login_required
def get_excel(request):
batch = request.POST.get('batch-check-view')
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(semester_id__semester_no = sem) & Q(course_id__code = course))
return_list = []
for registration in registrations:
return_list.append(registration.student_id.id.id)

return_list.sort()
output = BytesIO()

book = Workbook(output,{'in_memory':True})
title = book.add_format({'bold': True,
'font_size': 22,
'align': 'center',
'valign': 'vcenter'})
subtitle = book.add_format({'bold': True,
'font_size': 15,
'align': 'center',
'valign': 'vcenter'})
normaltext = book.add_format({'bold': False,
'font_size': 15,
'align': 'center',
'valign': 'vcenter'})
sheet = book.add_worksheet()
sheet.set_default_row(25)
sheet.write_string('A1','Student Roll no',subtitle)
sheet.write_string('B1','Student name',subtitle)
k=2
for no in return_list :
student= User.objects.get(username=no)
sheet.write_string('A'+str(k),no,normaltext)
sheet.write_string('B'+str(k),student.first_name+student.last_name,normaltext)
k+=1

book.close()
output.seek(0)

response = HttpResponse(output.read(),content_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
response['Content-Disposition'] = 'attachment; filename='+ course +'_student_list.xlsx'
response['Content-Transfer-Encoding'] = 'binary'
return response

@login_required
def add_new_profile (request):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2024-11-16 23:49

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('academic_procedures', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='initialregistration',
name='registration_type',
field=models.CharField(choices=[('Audit', 'Audit'), ('Improvement', 'Improvement'), ('Backlog', 'Backlog'), ('Regular', 'Regular')], default='Regular', max_length=20),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2024-11-17 00:34

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('academic_procedures', '0002_initialregistration_registration_type'),
]

operations = [
migrations.AddField(
model_name='finalregistration',
name='registration_type',
field=models.CharField(choices=[('Audit', 'Audit'), ('Improvement', 'Improvement'), ('Backlog', 'Backlog'), ('Regular', 'Regular')], default='Regular', max_length=20),
),
]
Loading
Loading