diff --git a/.gitignore b/.gitignore index 13184f251..68a42eadb 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,4 @@ FusionIIIT/static/ package-lock.json + diff --git a/FusionIIIT/Fusion/settings/development.py b/FusionIIIT/Fusion/settings/development.py index b0c92bccd..3f95a478c 100644 --- a/FusionIIIT/Fusion/settings/development.py +++ b/FusionIIIT/Fusion/settings/development.py @@ -9,10 +9,10 @@ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'fusiondb', - 'HOST': os.environ.get("DB_HOST"), - 'USER': 'fusionuser', - 'PASSWORD': 'password', + 'NAME': 'fusionlab', + 'HOST': os.environ.get("DB_HOST", default='localhost'), + 'USER': 'fusion_admin', + 'PASSWORD': 'hello123', } } diff --git a/FusionIIIT/applications/academic_information/admin.py b/FusionIIIT/applications/academic_information/admin.py index 94f60274d..522815707 100755 --- a/FusionIIIT/applications/academic_information/admin.py +++ b/FusionIIIT/applications/academic_information/admin.py @@ -32,4 +32,3 @@ class Curriculum_InstructorAdmin(admin.ModelAdmin): admin.site.register(Holiday) admin.site.register(Curriculum,CurriculumAdmin) -#Hello! diff --git a/FusionIIIT/applications/academic_information/api/serializers.py b/FusionIIIT/applications/academic_information/api/serializers.py index 06d6154c5..fd4fb59b7 100644 --- a/FusionIIIT/applications/academic_information/api/serializers.py +++ b/FusionIIIT/applications/academic_information/api/serializers.py @@ -18,7 +18,6 @@ class Meta: class CurriculumSerializer(serializers.ModelSerializer): course_id = CourseSerializer() - class Meta: model = Curriculum fields = ('curriculum_id','course_code','course_id','credits','course_type', diff --git a/FusionIIIT/applications/academic_information/models.py b/FusionIIIT/applications/academic_information/models.py index d5103fbd7..b3dfda008 100755 --- a/FusionIIIT/applications/academic_information/models.py +++ b/FusionIIIT/applications/academic_information/models.py @@ -69,7 +69,7 @@ class Student(models.Model): ''' Current Purpose : To store information pertinent to a user who is also a student - + ATTRIBUTES : diff --git a/FusionIIIT/applications/academic_information/views.py b/FusionIIIT/applications/academic_information/views.py index 22210a52e..fd80bc848 100755 --- a/FusionIIIT/applications/academic_information/views.py +++ b/FusionIIIT/applications/academic_information/views.py @@ -28,7 +28,7 @@ -from applications.academic_procedures.views import acad_proced_global_context +from applications.academic_procedures.views import acad_proced_global_context , get_sem_courses from applications.programme_curriculum.models import Batch @@ -107,7 +107,6 @@ def get_context(request): # course_type = Constants.COURSE_TYPE # timetable = Timetable.objects.all() # exam_t = Exam_timetable.objects.all() - procedures_context = acad_proced_global_context() try: @@ -842,12 +841,16 @@ def generatexlsheet(request): """ if user_check(request): return HttpResponseRedirect('/academic-procedures/') - + # print(request.POST) try: - batch = request.POST['batch'] - course = Courses.objects.get(id = request.POST['course']) + batch = request.POST['batch']#batch hai year wala (2020 , 21) + course_id = int(request.POST['course']) # id of course in integer + course = course = Courses.objects.get(id=course_id) + + # print(course.name) obj = course_registration.objects.all().filter(course_id = course) except Exception as e: + print(str(e)) batch="" course="" curr_key="" @@ -1029,9 +1032,14 @@ def generate_preregistration_report(request): max_width = max(max_width,len(choices_of_current_student)) for choice in range(1,len(choices_of_current_student)+1): - current_choice = InitialRegistration.objects.get(student_id=student, semester_id__semester_no=sem,course_slot_id = slot,priority = choice) - # #print("current choice is ",current_choice) - z.append(str(current_choice.course_id.code)+"-"+str(current_choice.course_id.name)) + try: + current_choice = InitialRegistration.objects.get(student_id=student, semester_id__semester_no=sem, course_slot_id=slot, priority=choice) + z.append(str(current_choice.course_id.code) + "-" + str(current_choice.course_id.name)) + except : + z.append("No registration found") + # current_choice = InitialRegistration.objects.get(student_id=student, semester_id__semester_no=sem,course_slot_id = slot,priority = choice) + # # #print("current choice is ",current_choice) + # z.append(str(current_choice.course_id.code)+"-"+str(current_choice.course_id.name)) data.append(z) m+=1 @@ -1169,9 +1177,9 @@ def add_new_profile (request): } if request.method == 'POST' and request.FILES: profiles=request.FILES['profiles'] - excel = xlrd.open_workbook(file_contents=profiles.read()) + excel = xlrd.open_workbook(profiles.name,file_contents=profiles.read()) sheet=excel.sheet_by_index(0) - for i in range(sheet.nrows): + for i in range(1,sheet.nrows): roll_no=sheet.cell(i,0).value first_name=str(sheet.cell(i,1).value) last_name=str(sheet.cell(i,2).value) @@ -1191,7 +1199,7 @@ def add_new_profile (request): category="" phone_no=0 address="" - dept=str(sheet.cell(i,12).value) + dept=str(sheet.cell(i,11).value) specialization=str(sheet.cell(i,12).value) hall_no=None @@ -1209,7 +1217,6 @@ def add_new_profile (request): batch_year=request.POST['Batch'] batch = Batch.objects.all().filter(name = programme_name, discipline__acronym = dept, year = batch_year).first() - user = User.objects.create_user( username=roll_no, password='hello123', @@ -1217,6 +1224,7 @@ def add_new_profile (request): last_name=last_name, email=email, ) + einfo = ExtraInfo.objects.create( id=roll_no, @@ -1253,6 +1261,11 @@ def add_new_profile (request): working=user, designation=desig, ) + + user.save() + einfo.save() + stud_data.save() + hold_des.save() sem_id = Semester.objects.get(curriculum = batch.curriculum, semester_no = sem) course_slots = CourseSlot.objects.all().filter(semester = sem_id) @@ -2063,14 +2076,15 @@ def view_all_student_data(request): "specailization": student.specialization, "gender" : student.id.sex, "category": student.category, - "pwd_status": student.pwd_status, + # "pwd_status": student.pwd_status, + "pwd_status": False, "Mobile": student.id.phone_no, "dob" : student.id.date_of_birth, "emailid" : student.id.user.email, "father_name": student.father_name, - "father_mobile_no": student.father_mobile_no, + # "father_mobile_no": student.father_mobile_no, "mother_name": student.mother_name, - "mother_mobile_no": student.mother_mobile_no, + # "mother_mobile_no": student.mother_mobile_no, "address": student.id.address } data.append(obj) @@ -2140,9 +2154,9 @@ def generatestudentxlsheet(request): data = None else: if(request_rollno != ""): - students = Student.objects.select_related('batch_id', 'id__user', 'batch_id__discipline', 'id').filter(id = request_rollno).only('batch', 'id__id', 'id__user', 'programme','pwd_status', 'father_mobile_no', 'mother_mobile_no', 'batch_id__discipline__acronym', 'specialization', 'id__sex', 'category', 'id__phone_no', 'id__date_of_birth', 'id__user__first_name', 'id__user__last_name', 'id__user__email', 'father_name', 'mother_name', 'id__address') + students = Student.objects.select_related('batch_id', 'id__user', 'batch_id__discipline', 'id').filter(id = request_rollno).only('batch', 'id__id', 'id__user', 'programme', 'batch_id__discipline__acronym', 'specialization', 'id__sex', 'category', 'id__phone_no', 'id__date_of_birth', 'id__user__first_name', 'id__user__last_name', 'id__user__email', 'father_name', 'mother_name', 'id__address') else: - students = Student.objects.select_related('batch_id', 'id__user', 'batch_id__discipline', 'id').filter(**filter_names).order_by('id').all().only('batch', 'id__id', 'id__user', 'programme','pwd_status', 'father_mobile_no', 'mother_mobile_no', 'batch_id__discipline__acronym', 'specialization', 'id__sex', 'category', 'id__phone_no', 'id__date_of_birth', 'id__user__first_name', 'id__user__last_name', 'id__user__email', 'father_name', 'mother_name', 'id__address') + students = Student.objects.select_related('batch_id', 'id__user', 'batch_id__discipline', 'id').filter(**filter_names).order_by('id').all().only('batch', 'id__id', 'id__user', 'programme', 'batch_id__discipline__acronym', 'specialization', 'id__sex', 'category', 'id__phone_no', 'id__date_of_birth', 'id__user__first_name', 'id__user__last_name', 'id__user__email', 'father_name', 'mother_name', 'id__address') for i in students: obj = [] obj.append(i.batch) @@ -2153,14 +2167,17 @@ def generatestudentxlsheet(request): obj.append(i.specialization) obj.append(i.id.sex) obj.append(i.category) - obj.append(i.pwd_status) + #obj.append(i.pwd_status) + obj.append(None) obj.append(i.id.phone_no) obj.append(i.id.date_of_birth) obj.append(i.id.user.email) obj.append(i.father_name) - obj.append(i.father_mobile_no) + #obj.append(i.father_mobile_no) + obj.append(None) obj.append(i.mother_name) - obj.append(i.mother_mobile_no) + # obj.append(i.mother_mobile_no) + obj.append(None) obj.append(i.id.address) data.append(obj) data.sort() diff --git a/FusionIIIT/applications/academic_procedures/api/serializers.py b/FusionIIIT/applications/academic_procedures/api/serializers.py index e8020d0e0..bf66ef870 100644 --- a/FusionIIIT/applications/academic_procedures/api/serializers.py +++ b/FusionIIIT/applications/academic_procedures/api/serializers.py @@ -1,13 +1,13 @@ from rest_framework.authtoken.models import Token from rest_framework import serializers -from applications.academic_procedures.models import (ThesisTopicProcess, InitialRegistrations, - FinalRegistrations, SemesterMarks, - BranchChange) +from applications.academic_procedures.models import (ThesisTopicProcess, InitialRegistrations,InitialRegistration, + FinalRegistration, FinalRegistrations, SemesterMarks, + BranchChange , StudentRegistrationChecks, Semester, backlog_course , CourseSlot , FeePayments , course_registration) from applications.academic_information.api.serializers import (CurriculumInstructorSerializer, - CurriculumSerializer) -from applications.globals.api.serializers import (UserSerializer, HoldsDesignationSerializer) + CurriculumSerializer , CourseSerializer , StudentSerializers ) +from applications.globals.api.serializers import (UserSerializer, HoldsDesignationSerializer , ExtraInfoSerializer) class ThesisTopicProcessSerializer(serializers.ModelSerializer): @@ -27,6 +27,24 @@ class Meta: model = FinalRegistrations fields = ('__all__') +class InitialRegistrationSerializer(serializers.ModelSerializer): + + class Meta: + model = InitialRegistration + fields = ('__all__') + +class FinalRegistrationSerializer(serializers.ModelSerializer): + + class Meta: + model = FinalRegistration + fields = ('__all__') + +class StudentRegistrationChecksSerializer(serializers.ModelSerializer): + class Meta: + model = StudentRegistrationChecks + fields = '__all__' + + class SemesterMarksSerializer(serializers.ModelSerializer): class Meta: @@ -38,3 +56,19 @@ class BranchChangeSerializer(serializers.ModelSerializer): class Meta: model = BranchChange fields = ('__all__') + +class SemesterSerializer(serializers.ModelSerializer): + + class Meta: + model = Semester + fields = ('__all__') + +class CourseRegistrationSerializer(serializers.ModelSerializer): + class Meta: + model = course_registration + fields = ('__all__') + +class CourseSlotSerializer(serializers.ModelSerializer): + class Meta: + model = CourseSlot + fields = ('__all__') \ No newline at end of file diff --git a/FusionIIIT/applications/academic_procedures/api/urls.py b/FusionIIIT/applications/academic_procedures/api/urls.py index 3abeace02..1bf63b660 100644 --- a/FusionIIIT/applications/academic_procedures/api/urls.py +++ b/FusionIIIT/applications/academic_procedures/api/urls.py @@ -1,12 +1,41 @@ from django.conf.urls import url - from . import views + urlpatterns = [ + url(r'^stu/details', views.academic_procedures_student, name='student_procedures'), + url(r'^stu/pre_registration' , views.student_pre_registration , name = 'pre_registration'), + url(r'^stu/final_registration' , views.student_final_registration , name = 'final_registration'), + url(r'^stu/view_registration' , views.student_view_registration , name = 'view_registration'), + url(r'^stu/view_offered_courses' , views.view_offered_courses , name = 'student_view_offered_courses'), + url(r'^stu/backlog_courses', views.student_backlog_courses , name = 'student_backlog_courses'), + url(r'^stu/add_course' , views.add_course , name ='add_course') , + url(r'^stu/drop_course' , views.drop_course , name = 'drop_course'), + # url(r'^stu/replaceCourse' , views.replaceCourse , name = 'replaceCourse') + + + + url(r'^acad/view_registrations' , views.acad_view_reigstrations , name='acad_view_registrations'), + url(r'^acad/get_course_list' , views.get_course_list , name = 'get_course_list' ), + url(r'^acad/configure_pre_registration' , views.configure_pre_registration_date , name = 'configure_pre_registration'), + url(r'^acad/configure_final_registration' , views.configure_final_registration_date , name = 'configure_final_registration'), + url(r'^acad/add_course_to_slot' , views.add_course_to_slot , name = 'add_course_to_slot'), + url(r'^acad/remove_course_from_slot' , views.remove_course_from_slot , name = 'remove_course_from_slot'), + url(r'^get_next_sem_courses' , views.get_next_sem_courses , name= 'get_next_sem_courses'), + + + url(r'^fac/view_assigned_courses' , views.faculty_assigned_courses , name = 'faculty_assigned_courses'), + # url(r'^fac/get_roll_list' , views.fetch_roll_list , name = 'fetch_roll_list'), + + + + url(r'^get_user_info' , views.get_user_info , name = 'get_user_info'), + + # these urls were designed previously and are not working any more - url(r'^fac/', views.academic_procedures_faculty, name='faculty_procedures'), - url(r'^stu/', views.academic_procedures_student, name='student_procedures'), - url(r'^addThesis/', views.add_thesis, name='add_thesis'), - url(r'^approve_thesis/(?P[0-9]+)/', views.approve_thesis, name='approve_thesis'), + # url(r'^fac/', views.academic_procedures_faculty, name='faculty_procedures'), + # url(r'^stu', views.academic_procedures_student, name='student_procedures'), + # url(r'^addThesis/', views.add_thesis, name='add_thesis'), + # url(r'^approve_thesis/(?P[0-9]+)/', views.approve_thesis, name='approve_thesis') -] +] \ No newline at end of file diff --git a/FusionIIIT/applications/academic_procedures/api/views.py b/FusionIIIT/applications/academic_procedures/api/views.py index aab6deaa7..99a807cd4 100644 --- a/FusionIIIT/applications/academic_procedures/api/views.py +++ b/FusionIIIT/applications/academic_procedures/api/views.py @@ -2,7 +2,9 @@ from django.contrib.auth import get_user_model from django.shortcuts import get_object_or_404, redirect +from django.db import transaction +from django.http import JsonResponse from rest_framework.permissions import IsAuthenticated from rest_framework.authentication import TokenAuthentication from rest_framework import status @@ -10,12 +12,16 @@ from rest_framework.permissions import AllowAny from rest_framework.response import Response -from applications.academic_information.models import Curriculum -from applications.academic_procedures.models import ThesisTopicProcess from applications.globals.models import HoldsDesignation, Designation, ExtraInfo -from applications.programme_curriculum.models import (CourseSlot, Course as Courses, Batch, Semester) +from applications.programme_curriculum.models import ( CourseSlot, Course as Courses, Batch, Semester) +from applications.academic_procedures.models import (Course, Student, Curriculum , ThesisTopicProcess, InitialRegistrations, + FinalRegistrations, SemesterMarks,backlog_course, + BranchChange , StudentRegistrationChecks, Semester , FeePayments , course_registration) + +from applications.academic_information.models import (Curriculum_Instructor , Calendar) + from applications.academic_procedures.views import (get_user_semester, get_acad_year, get_currently_registered_courses, get_current_credits, get_branch_courses, @@ -23,7 +29,9 @@ get_registration_courses, get_add_course_options, get_pre_registration_eligibility, get_final_registration_eligibility, - get_add_or_drop_course_date_eligibility) + get_add_or_drop_course_date_eligibility, + get_detailed_sem_courses, + InitialRegistration) from . import serializers @@ -31,46 +39,12 @@ date_time = datetime.datetime.now() -@api_view(['GET']) -def academic_procedures_faculty(request): - current_user = request.user - user_details = current_user.extrainfo - des = current_user.holds_designations.all().first() - if str(des.designation) == 'student': - return Response({'error':'Not a faculty'}, status=status.HTTP_400_BAD_REQUEST) - elif str(current_user) == 'acadadmin': - return Response({'error':'User is acadadmin'}, status=status.HTTP_400_BAD_REQUEST) - - elif str(des.designation) == "Associate Professor" or str(des.designation) == "Professor" or str(des.designation) == "Assistant Professor": - faculty_object = user_details.faculty - month = int(date_time.month) - sem = [] - if month>=7 and month<=12: - sem = [1,3,5,7] - else: - sem = [2,4,6,8] - student_flag = False - fac_flag = True - thesis_supervision_request_list = faculty_object.thesistopicprocess_supervisor.all() - thesis_supervision_request_list_data = serializers.ThesisTopicProcessSerializer(thesis_supervision_request_list, many=True).data - approved_thesis_request_list = serializers.ThesisTopicProcessSerializer(thesis_supervision_request_list.filter(approval_supervisor = True), many=True).data - pending_thesis_request_list = serializers.ThesisTopicProcessSerializer(thesis_supervision_request_list.filter(pending_supervisor = True), many=True).data - courses_list = serializers.CurriculumInstructorSerializer(user_details.curriculum_instructor_set.all(), many=True).data - fac_details = serializers.UserSerializer(current_user).data +#--------------------------------------- APIs of student---------------------------------------------------------- - resp = { - 'student_flag' : student_flag, - 'fac_flag' : fac_flag, - 'thesis_supervision_request_list' : thesis_supervision_request_list_data, - 'pending_thesis_request_list' : pending_thesis_request_list, - 'approved_thesis_request_list' : approved_thesis_request_list, - 'courses_list': courses_list, - 'faculty': fac_details - } - return Response(data=resp, status=status.HTTP_200_OK) +# with this student can get all his details in one api call @api_view(['GET']) def academic_procedures_student(request): current_user = request.user @@ -145,6 +119,7 @@ def academic_procedures_student(request): 'cpi' : cpi, 'spi' : cur_spi } + currently_registered_courses = get_currently_registered_courses(user_details.id, user_sem) currently_registered_courses_data = serializers.CurriculumSerializer(currently_registered_courses, many=True).data try: @@ -163,8 +138,11 @@ def academic_procedures_student(request): final_registered_courses_data = serializers.FinalRegistrationsSerializer(final_registered_courses, many=True).data current_credits = get_current_credits(currently_registered_courses) - - next_sem_branch_courses = get_branch_courses(current_user, user_sem+1, user_branch) + print(current_user, user_sem+1, user_branch) + try: + next_sem_branch_courses = get_branch_courses(current_user, user_sem+1, user_branch) + except Exception as e: + return Response(data = str(e)) next_sem_branch_courses_data = serializers.CurriculumSerializer(next_sem_branch_courses, many=True).data fee_payment_mode_list = dict(Constants.PaymentMode) @@ -173,7 +151,8 @@ def academic_procedures_student(request): next_sem_branch_registration_courses_data = [] for choices in next_sem_branch_registration_courses: next_sem_branch_registration_courses_data.append(serializers.CurriculumSerializer(choices, many=True).data) - # next_sem_branch_registration_courses_data = serializers.CurriculumSerializer(next_sem_branch_registration_courses, many=True).data + # print(next_sem_branch_registration_courses_data) + # next_sem_branch_registration_courses_data = serializers.CurriculumSerializer(next_sem_branch_registration_courses_data, many=True).data final_registration_choices = get_registration_courses(get_branch_courses(request.user, user_sem, user_branch)) final_registration_choices_data = [] @@ -196,7 +175,7 @@ def academic_procedures_student(request): current_sem_branch_courses = get_branch_courses(current_user, user_sem, user_branch) - pre_registration_date_flag = get_pre_registration_eligibility(current_date) + pre_registration_date_flag = get_pre_registration_eligibility(current_date , user_sem , acad_year) final_registration_date_flag = get_final_registration_eligibility(current_date) add_or_drop_course_date_flag = get_add_or_drop_course_date_eligibility(current_date) @@ -215,18 +194,6 @@ def academic_procedures_student(request): teaching_credit_registration_course = Curriculum.objects.all().filter(batch = 2016, sem =6) teaching_credit_registration_course_data = serializers.CurriculumSerializer(teaching_credit_registration_course, many=True).data - if student_flag: - try: - due = obj.dues_set.get() - lib_d = due.library_due - pc_d = due.placement_cell_due - hos_d = due.hostel_due - mess_d = due.mess_due - acad_d = due.academic_due - except: - lib_d, pc_d, hos_d, mess_d, acad_d = 0, 0, 0, 0, 0 - - tot_d = lib_d + acad_d + pc_d + hos_d + mess_d registers = obj.register_set.all() course_list = [] @@ -254,7 +221,7 @@ def academic_procedures_student(request): if user_sem == 2: branchchange_flag=True - # faculty_list = serializers.HoldsDesignationSerializer(get_faculty_list(), many=True).data + faculty_list = serializers.HoldsDesignationSerializer(get_faculty_list(), many=True).data resp = { 'details': details, @@ -267,15 +234,15 @@ def academic_procedures_student(request): 'fee_payment_mode_list' : fee_payment_mode_list, 'next_sem_branch_registration_courses' : next_sem_branch_registration_courses_data, 'final_registration_choices' : final_registration_choices_data, - 'performance_list' : performance_list_data, - 'thesis_request_list' : thesis_request_list, + + 'student_flag' : student_flag, 'ug_flag' : ug_flag, 'masters_flag' : masters_flag, 'phd_flag' : phd_flag, 'fac_flag' : fac_flag, 'des_flag' : des_flag, - 'thesis_flag' : pre_existing_thesis_flag, + 'drop_courses_options' : currently_registered_courses_data, 'pre_registration_date_flag': pre_registration_date_flag, 'final_registration_date_flag': final_registration_date_flag, @@ -283,116 +250,897 @@ def academic_procedures_student(request): 'pre_registration_flag' : pre_registration_flag, 'final_registration_flag': final_registration_flag, 'teaching_credit_registration_course' : teaching_credit_registration_course_data, - 'lib_d':lib_d, - 'acad_d':acad_d, - 'mess_d':mess_d, - 'pc_d':pc_d, - 'hos_d':hos_d, - 'tot_d':tot_d, + 'attendance': attendance_data, 'Branch_Change_Flag':branchchange_flag - # 'faculty_list' : faculty_list } - return Response(data=resp, status=status.HTTP_200_OK) + return Response(data=resp, status=status.HTTP_200_OK) + +# api for student for adding courses @api_view(['POST']) -def add_thesis(request): - current_user = request.user - profile = current_user.extrainfo - if profile.user_type == 'student': - if not 'thesis_topic' in request.data: - return Response({'error':'Thesis topic is required'}, status=status.HTTP_400_BAD_REQUEST) - if not 'research_area' in request.data: - return Response({'error':'Research area is required'}, status=status.HTTP_400_BAD_REQUEST) - if 'supervisor_id' in request.data: - try: - supervisor_faculty = User.objects.get(username=request.data['supervisor_id']) - supervisor_faculty = supervisor_faculty.extrainfo - request.data['supervisor_id'] = supervisor_faculty - except: - return Response({'error':'Wrong supervisor id. User does not exist.'}, status=status.HTTP_400_BAD_REQUEST) - else: - return Response({'error':'supervisor id is required'}, status=status.HTTP_400_BAD_REQUEST) - if 'co_supervisor_id' in request.data: +def add_course(request): + try: + current_user = request.user + current_user = ExtraInfo.objects.all().filter(user=current_user).first() + current_user = Student.objects.all().filter(id=current_user.id).first() + + sem_id_instance = Semester.objects.get(id = request.data['semester']) + + count = request.data['ct'] + count = int(count) + reg_curr = [] + + for i in range(1, count+1): + choice = "choice["+str(i)+"]" + slot = "slot["+str(i)+"]" try: - co_supervisor_faculty = User.objects.get(username=request.data['co_supervisor_id']) - co_supervisor_faculty = co_supervisor_faculty.extrainfo - request.data['co_supervisor_id'] = co_supervisor_faculty - except: - return Response({'error':'Wrong co_supervisor id. User does not exist.'}, status=status.HTTP_400_BAD_REQUEST) - else: - co_supervisor_faculty = None - if 'curr_id' in request.data: - curr_id = None - student = profile.student - request.data['student_id'] = profile - request.data['submission_by_student'] = True - serializer = serializers.ThesisTopicProcessSerializer(data=request.data) - if serializer.is_valid(): - serializer.save() - return Response(serializer.data, status=status.HTTP_200_OK) - else: - return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) - else: - return Response({'error':'Cannot add thesis'}, status=status.HTTP_400_BAD_REQUEST) + course_id_instance = Courses.objects.get(id = request.data[choice]) + courseslot_id_instance = CourseSlot.objects.get(id = request.data[slot]) + + print(courseslot_id_instance.max_registration_limit) + if course_registration.objects.filter(working_year = current_user.batch_id.year, course_id = course_id_instance).count() < courseslot_id_instance.max_registration_limit and (course_registration.objects.filter(course_id=course_id_instance, student_id=current_user).count() == 0): + p = course_registration( + course_id=course_id_instance, + student_id=current_user, + course_slot_id=courseslot_id_instance, + semester_id=sem_id_instance + ) + print(serializers.course_registration(p)) + if p not in reg_curr: + reg_curr.append(p) + else: + print("already exist") + except Exception as e: + error_message = str(e) + resp = {'message': 'Course addition failed', 'error': error_message} + return Response(resp, status=status.HTTP_400_BAD_REQUEST) + print(reg_curr) + course_registration_data = course_registration.objects.bulk_create(reg_curr) + course_registration_data = serializers.CourseRegistrationSerializer(course_registration_data , many = True).data + res = {'message' : 'Courses successfully added' , "courses_added" : course_registration_data } + return Response(data = res , status = status.HTTP_200_OK) + except Exception as e: + return Response(data = str(e) , status= status.HTTP_500_INTERNAL_SERVER_ERROR) -@api_view(['PUT']) -def approve_thesis(request, id): + +@api_view(['POST']) +def drop_course(request): current_user = request.user - profile = current_user.extrainfo - if profile.user_type == 'faculty': + current_user = ExtraInfo.objects.all().filter(user=current_user).first() + current_user = Student.objects.all().filter(id = current_user.id).first() + + courses = request.data['courses'] + + for course in courses: try: - thesis = ThesisTopicProcess.objects.get(id=id) - except: - return Response({'error':'This thesis does not exist'}, status=status.HTTP_400_BAD_REQUEST) - if 'member1' in request.data: - try: - user1 = User.objects.get(username=request.data['member1']) - member1 = user1.extrainfo - request.data['member1'] = member1 - except: - return Response({'error':'Wrong username of member 1. User does not exist.'}, status=status.HTTP_400_BAD_REQUEST) - else: - return Response({'error':'Member 1 is required'}, status=status.HTTP_400_BAD_REQUEST) - if 'member2' in request.data: - try: - user2 = User.objects.get(username=request.data['member2']) - member2 = user2.extrainfo - request.data['member2'] = member2 - except: - return Response({'error':'Wrong username of member 2. User does not exist.'}, status=status.HTTP_400_BAD_REQUEST) - else: - return Response({'error':'Member 2 is required'}, status=status.HTTP_400_BAD_REQUEST) - if 'member3' in request.data: - try: - user3 = User.objects.get(username=request.data['member3']) - member3 = user3.extrainfo - request.data['member3'] = member3 - except: - return Response({'error':'Wrong username of member 3. User does not exist.'}, status=status.HTTP_400_BAD_REQUEST) - else: - member3 = None - if not 'approval' in request.data: - return Response({'error':'Approval value is required.'}, status=status.HTTP_400_BAD_REQUEST) - elif request.data['approval'] != 'yes' and request.data['approval'] != 'no': - return Response({'error':'Wrong approval value provided. Approval value should be yes or no'}, status=status.HTTP_400_BAD_REQUEST) - if request.data['approval'] == 'yes': - request.data.pop('approval', None) - request.data['pending_supervisor'] = False - request.data['approval_supervisor'] = True - request.data['forwarded_to_hod'] = True - request.data['pending_hod'] = True - else: - request.data.pop('approval', None) - request.data['pending_supervisor'] = False - request.data['approval_supervisor'] = False - request.data['forwarded_to_hod'] = False - request.data['pending_hod'] = False - serializer = serializers.ThesisTopicProcessSerializer(thesis, data=request.data, partial=True) - if serializer.is_valid(): - serializer.save() - return Response(serializer.data, status=status.HTTP_200_OK) - else: - return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) - else: - return Response({'error':'Cannot approve thesis'}, status=status.HTTP_400_BAD_REQUEST) + course_id = Courses.objects.all().filter(id=course).first() + course_registration.objects.filter(course_id = course_id, student_id = current_user).delete() + except Exception as e: + resp = {"message" : "Course drop failed", "error" : str(e)} + return Response(data = resp, status = status.HTTP_400_BAD_REQUEST) + + resp = {"message" : "Course successfully dropped"} + return Response(data = resp , status = status.HTTP_200_OK) + + +# simple api for getting to know the details of user who have logined in the system +@api_view(['GET']) +def get_user_info(request): + current_user = request.user + details1 = serializers.UserSerializer(current_user).data + details2 = serializers.ExtraInfoSerializer(current_user.extrainfo).data + details = { + "user_serializer_Data" : details1, + "ExtraInfoSerializer_Data" : details2 + } + return Response(data = details , status= status.HTTP_200_OK) + + +# with this api student can see the list of courses offered to him in upcoming semester +@api_view(['GET']) +def view_offered_courses(request): + try : + obj = Curriculum.objects.filter( + programme = request.data['programme'], + branch = request.data['branch'], + batch = request.data["batch"], + sem = request.data["semester"] + ) + serializer = serializers.CurriculumSerializer(obj, many=True).data + return Response(serializer, status=status.HTTP_200_OK) + except Exception as e: + return Response(data = str(e) , status=status.HTTP_500_INTERNAL_SERVER_ERROR) + # try: + # ug_flag = True + # masters_flag = False + # phd_flag = False + # current_semester = get_user_semester(request.user, ug_flag, masters_flag, phd_flag) + # current_year = date_time.date().year + + # return Response(data= { } , status=status.HTTP_200_OK) + # except Exception as e: + # return Response(data = {"error" : str(e)} , status= status.HTTP_500_INTERNAL_SERVER_ERROR) + + +# with this student can know status of pre registration and final registration +@api_view(['GET']) +def student_view_registration(request): + try: + # getting the registration status of current user for the given semester + current_user = request.user + student_id = current_user.extrainfo.id + + sem_id = Semester.objects.get(id = request.data.get('semester')) + sem_id = serializers.SemesterSerializer(sem_id).data["id"] + + # filter based on the semester id and student id + obj = StudentRegistrationChecks.objects.filter(semester_id_id = sem_id, student_id = student_id) + + # serialize the data for displaying + serializer = serializers.StudentRegistrationChecksSerializer(obj, many=True).data + + return Response(serializer, status=status.HTTP_200_OK) + except Exception as e: + return Response(data = str(e) , status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + +# with this student can do his pre registration for the upcoming semester +@api_view(['POST']) +@transaction.atomic +def student_pre_registration(request): + try: + current_user = request.user + current_user_id = serializers.UserSerializer(current_user).data["id"] + s_id = current_user.extrainfo.id + + current_user = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user_id).first() + current_user = serializers.ExtraInfoSerializer(current_user).data + + current_user_instance = Student.objects.all().filter(id=current_user["id"]).first() + current_user = serializers.StudentSerializers(current_user_instance).data + + sem_id_instance = Semester.objects.get(id = request.data.get('semester')) + sem_id = serializers.SemesterSerializer(sem_id_instance).data["id"] + + # filter based on the semester id and student id + obj = StudentRegistrationChecks.objects.filter(semester_id_id = sem_id, student_id = s_id) + # serialize the data for displaying + student_registration_check = serializers.StudentRegistrationChecksSerializer(obj, many=True).data + + try: + # check if user have already done pre registration + if(student_registration_check and student_registration_check[0]["pre_registration_flag"] ): + return Response(data = {"message" : "You have already registered for this semester" }, status=status.HTTP_400_BAD_REQUEST) + except Exception as e: + return Response(data = str(e) , status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + course_slots=request.data.get("course_slot") + reg_curr = [] + + + for course_slot in course_slots : + course_priorities = request.data.get("course_priority-"+course_slot) + if(course_priorities[0] == 'NULL'): + print("NULL FOUND") + continue + course_slot_id_for_model = CourseSlot.objects.get(id = int(course_slot)) + + # return Response(data = course_slots , status=status.HTTP_200_OK) + for course_priority in course_priorities: + priority_of_current_course,course_id = map(int,course_priority.split("-")) + # get course id for the model + course_id_for_model = Courses.objects.get(id = course_id) + print("check") + p = InitialRegistration( + course_id = course_id_for_model, + semester_id = sem_id_instance, + student_id = current_user_instance, + course_slot_id = course_slot_id_for_model, + priority = priority_of_current_course + ) + p.save() + reg_curr.append(p) + + + try: + serialized_reg_curr = serializers.InitialRegistrationSerializer(reg_curr, many=True).data + + registration_check = StudentRegistrationChecks( + student_id = current_user_instance, + pre_registration_flag = True, + final_registration_flag = False, + semester_id = sem_id_instance + ) + registration_check.save() + return Response(data={"message": "Successfully Registered for the courses.", "registrations": serialized_reg_curr}, status=status.HTTP_200_OK) + except Exception as e: + return Response(data = {"message" : "Error in Registration." , "error" : str(e)} , status=status.HTTP_500_INTERNAL_SERVER_ERROR) + except Exception as e: + return Response(data = {"message" : "Error in Registration." , "error" : str(e)} , status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + +# with this student can do his final registration for the upcoming semester +@api_view(['POST']) +@transaction.atomic +def student_final_registration(request): + try: + current_user = request.user + current_user_id = serializers.UserSerializer(current_user).data["id"] + s_id = current_user.extrainfo.id + + current_user = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() + current_user = serializers.ExtraInfoSerializer(current_user).data + + current_user_instance = Student.objects.all().filter(id=current_user["id"]).first() + current_user = serializers.StudentSerializers(current_user_instance).data + + # these details we need from the body of the request fot doing final registration + sem_id_instance = Semester.objects.get(id = request.data.get('semester')) + sem_id = serializers.SemesterSerializer(sem_id_instance).data["id"] + registration_status = StudentRegistrationChecks.objects.filter(student_id = current_user["id"], semester_id = sem_id) + registration_status = serializers.StudentRegistrationChecksSerializer(registration_status , many = True ).data + + if(registration_status[0] and registration_status[0]["pre_registration_flag"] == False): + return Response(data = {"message" : "Student haven't done pre registration yet."} , status= status.HTTP_400_BAD_REQUEST ) + + mode = str(request.data.get('mode')) + transaction_id = str(request.data.get('transaction_id')) + deposit_date = request.data.get('deposit_date') + utr_number = str(request.data.get('utr_number')) + fee_paid = request.data.get('fee_paid') + actual_fee = request.data.get('actual_fee') + reason = str(request.data.get('reason')) + if reason=="": + reason=None + fee_receipt = request.FILES['fee_receipt'] + + print(fee_receipt) + obj = FeePayments( + student_id = current_user_instance, + semester_id = sem_id_instance, + mode = mode, + transaction_id = transaction_id, + fee_receipt = fee_receipt, + deposit_date = deposit_date, + utr_number = utr_number, + fee_paid = fee_paid, + actual_fee = actual_fee, + reason = reason + ) + obj.save() + try: + registration_status = StudentRegistrationChecks.objects.filter(student_id = current_user["id"], semester_id = sem_id).update(final_registration_flag = True) + return Response(data = {"message" : "Final Registration Successfull" } , status= status.HTTP_200_OK) + except Exception as e: + return Response(data = {"message" : "Final Registration Failed " , "error" : str(e)} , status = status.HTTP_500_INTERNAL_SERVER_ERROR) + except Exception as e: + return Response(data = {"message" : "Final Registration Failed " , "error" : str(e)} , status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + +# with this api student can get his backlog courses list +@api_view(['GET']) +def student_backlog_courses(request): + try : + stu_id = Student.objects.select_related('id','id__user','id__department').get(id=request.user.username) + backlogCourseList = [] + backlogCourses = backlog_course.objects.select_related('course_id' , 'student_id' , 'semester_id' ).filter(student_id=stu_id) + for i in backlogCourses: + obj = { + "course_id" : i.course_id.id, + "course_name" : i.course_id.course_name, + "faculty" : i.course_id.course_details, + "semester" : i.semester_id.semester_no, + "is_summer_course" : i.is_summer_course + } + backlogCourseList.append(obj) + + return Response(backlogCourseList, status=status.HTTP_200_OK) + except Exception as e: + return Response(data = str(e) , status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + + +#--------------------------------------- APIs of acad person---------------------------------------------------------- + + +# with this acad admin can fetch the list of courses for any batch , semester and brach +@api_view(['GET']) +def get_course_list(request): + + programme = request.data['programme'] + branch = request.data['branch'] + batch = request.data['batch'] + + try : + print(programme , branch , batch) + obj = Curriculum.objects.filter( + programme = request.data['programme'], + branch = request.data['branch'], + batch = request.data["batch"] + ) + serializer = serializers.CurriculumSerializer(obj, many=True).data + return Response(serializer, status=status.HTTP_200_OK) + except Exception as e: + return Response(data = str(e) , status=status.HTTP_500_INTERNAL_SERVER_ERROR) + # obj = Curriculum.objects.filter(curriculum_id_=curriculum_id, course_type_ = course_type, programme_ = programme, batch_ = batch, branch_ = branch, sem_ = sem, optional_ = optional) + + +# with this api acad person can see the list of students who have completed their pre and final registrations for any semester +@api_view(['GET']) +def acad_view_reigstrations(request): + try: + semester = request.data["semester"] + sem_id_instance = Semester.objects.get(id = request.data.get('semester')) + sem_id = serializers.SemesterSerializer(sem_id_instance).data["id"] + obj = StudentRegistrationChecks.objects.filter(semester_id_id = sem_id, final_registration_flag =True) + student_registration_check = serializers.StudentRegistrationChecksSerializer(obj, many=True).data + + return Response(data= student_registration_check , status=status.HTTP_200_OK) + except Exception as e: + return Response(data = {"error" : str(e)} , status= status.HTTP_500_INTERNAL_SERVER_ERROR) + + +# with this api acad person set the date of pre registration date for any semester +@api_view(['POST']) +def configure_pre_registration_date(request): + try: + try: + from_date = request.data.get('from_date') + to_date = request.data.get('to_date') + semester = request.data.get('semester') + current_year = date_time.date().year + desc = "Pre Registration " + str(semester) +" " + str(current_year) + print(from_date , to_date , desc) + from_date = from_date.split('-') + from_date = [int(i) for i in from_date] + from_date = datetime.datetime(*from_date).date() + to_date = to_date.split('-') + to_date = [int(i) for i in to_date] + to_date = datetime.datetime(*to_date).date() + except Exception as e: + from_date="" + to_date="" + desc="" + pass + c = Calendar( + from_date=from_date, + to_date=to_date, + description=desc) + c.save() + return Response(data = {"message" : "Pre registration for semester " + str(semester) + " will be opened from " + str(from_date) + " to " + str(to_date) + ". " , } , status= status.HTTP_200_OK) + except Exception as e: + return Response(data = {"error " : str(e)} , status= status.HTTP_500_INTERNAL_SERVER_ERROR) + + +# with this api request acad person can set the date of final registration +@api_view(['POST']) +def configure_final_registration_date(request): + try: + try: + from_date = request.data.get('from_date') + to_date = request.data.get('to_date') + semester = request.data.get('semester') + current_year = date_time.date().year + desc = "Physical Reporting at the Institute" + print(from_date , to_date , desc) + from_date = from_date.split('-') + from_date = [int(i) for i in from_date] + from_date = datetime.datetime(*from_date).date() + to_date = to_date.split('-') + to_date = [int(i) for i in to_date] + to_date = datetime.datetime(*to_date).date() + except Exception as e: + from_date="" + to_date="" + desc="" + pass + c = Calendar( + from_date=from_date, + to_date=to_date, + description=desc) + c.save() + return Response(data = {"message" : "Physical Reporting at the Institute will be opened from " + str(from_date) + " to " + str(to_date) + ". " , } , status= status.HTTP_200_OK) + except Exception as e: + return Response(data = {"error " : str(e)} , status= status.HTTP_500_INTERNAL_SERVER_ERROR) + +# with this api request acad person can add any courses in a specific slot +@api_view(['POST']) +def add_course_to_slot(request): + course_code = request.data.get('course_code') + course_slot_name = request.data.get('course_slot_name') + try: + course_slot = CourseSlot.objects.get(name=course_slot_name) + course = Courses.objects.get(code=course_code) + course_slot.courses.add(course) + + return JsonResponse({'message': f'Course {course_code} added to slot {course_slot_name} successfully.'}, status=200) + except CourseSlot.DoesNotExist: + return JsonResponse({'error': 'Course slot does not exist.'}, status=400) + except Course.DoesNotExist: + return JsonResponse({'error': 'Course does not exist.'}, status=400) + +# with this api request acad person can remove any course from a specific slot +@api_view(['POST']) +def remove_course_from_slot(request): + course_code = request.data.get('course_code') + course_slot_name = request.data.get('course_slot_name') + try: + course_slot = CourseSlot.objects.get(name=course_slot_name) + course = Courses.objects.get(code=course_code) + course_slot.courses.remove(course) + return JsonResponse({'message': f'Course {course_code} removed from slot {course_slot_name} successfully.'}, status=200) + except CourseSlot.DoesNotExist: + return JsonResponse({'error': 'Course slot does not exist.'}, status=400) + except Course.DoesNotExist: + return JsonResponse({'error': 'Course does not exist.'}, status=400) + + + +#--------------------------------------- APIs of faculty---------------------------------------------------------- + +# with this api faculty can know what are the courses assigned to him +@api_view(['GET']) +def faculty_assigned_courses(request): + try: + current_user = request.user + curriculum_ids = Curriculum_Instructor.objects.filter(instructor_id=current_user.id).values_list('curriculum_id', flat=True) + course_infos = [] + print(current_user.id) + for curriculum_id in curriculum_ids: + course_info = Curriculum.objects.filter(curriculum_id=curriculum_id).values_list('course_code','course_type','programme','branch','sem','course_id_id').first() + course_infos.append(course_info) + + return Response(data= course_infos , status=status.HTTP_200_OK) + except Exception as e: + return Response(data = {"error" : str(e)} , status= status.HTTP_500_INTERNAL_SERVER_ERROR) + + +@api_view(['POST']) +def get_next_sem_courses(request): + try: + next_sem = request.data.get('next_sem') + branch = request.data.get('branch') + programme = request.data.get('programme') + batch = request.data.get('batch') + + # we go to student table and apply filters and get batch_id of the students with these filter + batch_id = Student.objects.filter(programme = programme , batch = batch , specialization = branch)[0].batch_id + + curr_id = batch_id.curriculum + next_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = next_sem) + + if next_sem_id: + next_sem_registration_courses = get_detailed_sem_courses(next_sem_id ) + return JsonResponse(next_sem_registration_courses, safe=False) + except Exception as e: + return Response(data = {"error" : str(e)} , status= status.HTTP_500_INTERNAL_SERVER_ERROR) + + + + + + + + + + + +# These apis were implemented before but now don't use them they have some errors + + +# @api_view(['GET']) +# def academic_procedures_faculty(request): +# current_user = request.user +# user_details = current_user.extrainfo +# des = current_user.holds_designations.all().first() + +# if str(des.designation) == 'student': +# return Response({'error':'Not a faculty'}, status=status.HTTP_400_BAD_REQUEST) +# elif str(current_user) == 'acadadmin': +# return Response({'error':'User is acadadmin'}, status=status.HTTP_400_BAD_REQUEST) + +# elif str(des.designation) == "Associate Professor" or str(des.designation) == "Professor" or str(des.designation) == "Assistant Professor": +# faculty_object = user_details.faculty +# month = int(date_time.month) +# sem = [] +# if month>=7 and month<=12: +# sem = [1,3,5,7] +# else: +# sem = [2,4,6,8] +# student_flag = False +# fac_flag = True + +# thesis_supervision_request_list = faculty_object.thesistopicprocess_supervisor.all() +# thesis_supervision_request_list_data = serializers.ThesisTopicProcessSerializer(thesis_supervision_request_list, many=True).data +# approved_thesis_request_list = serializers.ThesisTopicProcessSerializer(thesis_supervision_request_list.filter(approval_supervisor = True), many=True).data +# pending_thesis_request_list = serializers.ThesisTopicProcessSerializer(thesis_supervision_request_list.filter(pending_supervisor = True), many=True).data +# courses_list = serializers.CurriculumInstructorSerializer(user_details.curriculum_instructor_set.all(), many=True).data +# fac_details = serializers.UserSerializer(current_user).data + +# resp = { +# 'student_flag' : student_flag, +# 'fac_flag' : fac_flag, +# 'thesis_supervision_request_list' : thesis_supervision_request_list_data, +# 'pending_thesis_request_list' : pending_thesis_request_list, +# 'approved_thesis_request_list' : approved_thesis_request_list, +# 'courses_list': courses_list, +# 'faculty': fac_details +# } +# return Response(data=resp, status=status.HTTP_200_OK) + + + + + + +# @api_view(['GET']) +# def academic_procedures_student(request): +# current_user = request.user +# current_user_data = { +# 'first_name': current_user.first_name, +# 'last_name': current_user.last_name, +# 'username': current_user.username, +# 'email': current_user.email +# } +# user_details = current_user.extrainfo +# des = current_user.holds_designations.all().first() +# if str(des.designation) == 'student': +# obj = user_details.student + +# if obj.programme.upper() == "PH.D": +# student_flag = True +# ug_flag = False +# masters_flag = False +# phd_flag = True +# fac_flag = False +# des_flag = False + +# elif obj.programme.upper() == "M.DES": +# student_flag = True +# ug_flag = False +# masters_flag = True +# phd_flag = False +# fac_flag = False +# des_flag = True + +# elif obj.programme.upper() == "B.DES": +# student_flag = True +# ug_flag = True +# masters_flag = False +# phd_flag = False +# fac_flag = False +# des_flag = True + +# elif obj.programme.upper() == "M.TECH": +# student_flag = True +# ug_flag = False +# masters_flag = True +# phd_flag = False +# fac_flag = False +# des_flag = False + +# elif obj.programme.upper() == "B.TECH": +# student_flag = True +# ug_flag = True +# masters_flag = False +# phd_flag = False +# fac_flag = False +# des_flag = False + +# else: +# return Response({'message':'Student has no record'}, status=status.HTTP_400_BAD_REQUEST) + +# current_date = date_time.date() +# current_year = date_time.year +# batch = obj.batch_id +# user_sem = get_user_semester(request.user, ug_flag, masters_flag, phd_flag) +# acad_year = get_acad_year(user_sem, current_year) +# user_branch = user_details.department.name +# cpi = obj.cpi +# cur_spi='Sem results not available' # To be fetched from db if result uploaded + +# details = { +# 'current_user': current_user_data, +# 'year': acad_year, +# 'user_sem': user_sem, +# 'user_branch' : str(user_branch), +# 'cpi' : cpi, +# 'spi' : cur_spi +# } + +# currently_registered_courses = get_currently_registered_courses(user_details.id, user_sem) +# currently_registered_courses_data = serializers.CurriculumSerializer(currently_registered_courses, many=True).data +# try: +# pre_registered_courses = obj.initialregistrations_set.all().filter(semester = user_sem) +# pre_registered_courses_show = obj.initialregistrations_set.all().filter(semester = user_sem+1) +# except: +# pre_registered_courses = None +# pre_registered_courses_show=None +# try: +# final_registered_courses = obj.finalregistrations_set.all().filter(semester = user_sem) +# except: +# final_registered_courses = None + +# pre_registered_courses_data = serializers.InitialRegistrationsSerializer(pre_registered_courses, many=True).data +# pre_registered_courses_show_data = serializers.InitialRegistrationsSerializer(pre_registered_courses_show, many=True).data +# final_registered_courses_data = serializers.FinalRegistrationsSerializer(final_registered_courses, many=True).data + +# current_credits = get_current_credits(currently_registered_courses) +# print(current_user, user_sem+1, user_branch) +# try: +# next_sem_branch_courses = get_branch_courses(current_user, user_sem+1, user_branch) +# except Exception as e: +# return Response(data = str(e)) +# next_sem_branch_courses_data = serializers.CurriculumSerializer(next_sem_branch_courses, many=True).data + +# fee_payment_mode_list = dict(Constants.PaymentMode) + +# next_sem_branch_registration_courses = get_registration_courses(next_sem_branch_courses) +# next_sem_branch_registration_courses_data = [] +# for choices in next_sem_branch_registration_courses: +# next_sem_branch_registration_courses_data.append(serializers.CurriculumSerializer(choices, many=True).data) +# # next_sem_branch_registration_courses_data = serializers.CurriculumSerializer(next_sem_branch_registration_courses, many=True).data + +# final_registration_choices = get_registration_courses(get_branch_courses(request.user, user_sem, user_branch)) +# final_registration_choices_data = [] +# for choices in final_registration_choices: +# final_registration_choices_data.append(serializers.CurriculumSerializer(choices, many=True).data) + +# performance_list = [] +# result_announced = False +# for i in currently_registered_courses: +# try: +# performance_obj = obj.semestermarks_set.all().filter(curr_id = i).first() +# except: +# performance_obj = None +# performance_list.append(performance_obj) +# performance_list_data = serializers.SemesterMarksSerializer(performance_list, many=True).data + +# thesis_request_list = serializers.ThesisTopicProcessSerializer(obj.thesistopicprocess_set.all(), many=True).data + +# pre_existing_thesis_flag = True if obj.thesistopicprocess_set.all() else False + +# current_sem_branch_courses = get_branch_courses(current_user, user_sem, user_branch) + +# # pre_registration_date_flag = get_pre_registration_eligibility(current_date) +# final_registration_date_flag = get_final_registration_eligibility(current_date) + +# add_or_drop_course_date_flag = get_add_or_drop_course_date_eligibility(current_date) + +# student_registration_check_pre = obj.studentregistrationcheck_set.all().filter(semester=user_sem+1) +# student_registration_check_final = obj.studentregistrationcheck_set.all().filter(semester=user_sem) +# pre_registration_flag = False +# final_registration_flag = False +# if(student_registration_check_pre): +# pre_registration_flag = student_registration_check_pre.pre_registration_flag +# if(student_registration_check_final): +# final_registration_flag = student_registration_check_final.final_registration_flag + +# teaching_credit_registration_course = None +# if phd_flag: +# teaching_credit_registration_course = Curriculum.objects.all().filter(batch = 2016, sem =6) +# teaching_credit_registration_course_data = serializers.CurriculumSerializer(teaching_credit_registration_course, many=True).data + +# if student_flag: +# try: +# due = obj.dues_set.get() +# lib_d = due.library_due +# pc_d = due.placement_cell_due +# hos_d = due.hostel_due +# mess_d = due.mess_due +# acad_d = due.academic_due +# except: +# lib_d, pc_d, hos_d, mess_d, acad_d = 0, 0, 0, 0, 0 + +# tot_d = lib_d + acad_d + pc_d + hos_d + mess_d + +# registers = obj.register_set.all() +# course_list = [] +# for i in registers: +# course_list.append(i.curr_id) +# attendence = [] +# for i in course_list: +# instructors = i.curriculum_instructor_set.all() +# pr,ab=0,0 +# for j in list(instructors): + +# presents = obj.student_attendance_set.all().filter(instructor_id=j, present=True) +# absents = obj.student_attendance_set.all().filter(instructor_id=j, present=False) +# pr += len(presents) +# ab += len(absents) +# attendence.append((i,pr,pr+ab)) +# attendance_data = {} +# for course in attendence: +# attendance_data[course[0].course_id.course_name] = { +# 'present' : course[1], +# 'total' : course[2] +# } + +# branchchange_flag = False +# if user_sem == 2: +# branchchange_flag=True + +# faculty_list = serializers.HoldsDesignationSerializer(get_faculty_list(), many=True).data + +# resp = { +# 'details': details, +# 'currently_registered': currently_registered_courses_data, +# # 'pre_registered_courses' : pre_registered_courses_data, +# # 'pre_registered_courses_show' : pre_registered_courses_show_data, +# 'final_registered_courses' : final_registered_courses_data, +# 'current_credits' : current_credits, +# 'courses_list': next_sem_branch_courses_data, +# 'fee_payment_mode_list' : fee_payment_mode_list, +# 'next_sem_branch_registration_courses' : next_sem_branch_registration_courses_data, +# 'final_registration_choices' : final_registration_choices_data, +# 'performance_list' : performance_list_data, +# 'thesis_request_list' : thesis_request_list, +# 'student_flag' : student_flag, +# 'ug_flag' : ug_flag, +# 'masters_flag' : masters_flag, +# 'phd_flag' : phd_flag, +# 'fac_flag' : fac_flag, +# 'des_flag' : des_flag, +# 'thesis_flag' : pre_existing_thesis_flag, +# 'drop_courses_options' : currently_registered_courses_data, +# # 'pre_registration_date_flag': pre_registration_date_flag, +# 'final_registration_date_flag': final_registration_date_flag, +# 'add_or_drop_course_date_flag': add_or_drop_course_date_flag, +# # 'pre_registration_flag' : pre_registration_flag, +# 'final_registration_flag': final_registration_flag, +# 'teaching_credit_registration_course' : teaching_credit_registration_course_data, +# 'lib_d':lib_d, +# 'acad_d':acad_d, +# 'mess_d':mess_d, +# 'pc_d':pc_d, +# 'hos_d':hos_d, +# 'tot_d':tot_d, +# 'attendance': attendance_data, +# 'Branch_Change_Flag':branchchange_flag +# # 'faculty_list' : faculty_list +# } +# return Response(data=resp, status=status.HTTP_200_OK) + + + + + + + + + + + + + + + + + + + + + + +# These apis are not needed in this module + + + +# @api_view(['POST']) +# def add_thesis(request): +# current_user = request.user +# profile = current_user.extrainfo +# if profile.user_type == 'student': +# if not 'thesis_topic' in request.data: +# return Response({'error':'Thesis topic is required'}, status=status.HTTP_400_BAD_REQUEST) +# if not 'research_area' in request.data: +# return Response({'error':'Research area is required'}, status=status.HTTP_400_BAD_REQUEST) +# if 'supervisor_id' in request.data: +# try: +# supervisor_faculty = User.objects.get(username=request.data['supervisor_id']) +# supervisor_faculty = supervisor_faculty.extrainfo +# request.data['supervisor_id'] = supervisor_faculty +# except: +# return Response({'error':'Wrong supervisor id. User does not exist.'}, status=status.HTTP_400_BAD_REQUEST) +# else: +# return Response({'error':'supervisor id is required'}, status=status.HTTP_400_BAD_REQUEST) +# if 'co_supervisor_id' in request.data: +# try: +# co_supervisor_faculty = User.objects.get(username=request.data['co_supervisor_id']) +# co_supervisor_faculty = co_supervisor_faculty.extrainfo +# request.data['co_supervisor_id'] = co_supervisor_faculty +# except: +# return Response({'error':'Wrong co_supervisor id. User does not exist.'}, status=status.HTTP_400_BAD_REQUEST) +# else: +# co_supervisor_faculty = None +# if 'curr_id' in request.data: +# curr_id = None +# student = profile.student +# request.data['student_id'] = profile +# request.data['submission_by_student'] = True +# serializer = serializers.ThesisTopicProcessSerializer(data=request.data) +# if serializer.is_valid(): +# serializer.save() +# return Response(serializer.data, status=status.HTTP_200_OK) +# else: +# return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) +# else: +# return Response({'error':'Cannot add thesis'}, status=status.HTTP_400_BAD_REQUEST) + + + + + + + + + + + + + + + + + +# @api_view(['PUT']) +# def approve_thesis(request, id): +# current_user = request.user +# profile = current_user.extrainfo +# if profile.user_type == 'faculty': +# try: +# thesis = ThesisTopicProcess.objects.get(id=id) +# except: +# return Response({'error':'This thesis does not exist'}, status=status.HTTP_400_BAD_REQUEST) +# if 'member1' in request.data: +# try: +# user1 = User.objects.get(username=request.data['member1']) +# member1 = user1.extrainfo +# request.data['member1'] = member1 +# except: +# return Response({'error':'Wrong username of member 1. User does not exist.'}, status=status.HTTP_400_BAD_REQUEST) +# else: +# return Response({'error':'Member 1 is required'}, status=status.HTTP_400_BAD_REQUEST) +# if 'member2' in request.data: +# try: +# user2 = User.objects.get(username=request.data['member2']) +# member2 = user2.extrainfo +# request.data['member2'] = member2 +# except: +# return Response({'error':'Wrong username of member 2. User does not exist.'}, status=status.HTTP_400_BAD_REQUEST) +# else: +# return Response({'error':'Member 2 is required'}, status=status.HTTP_400_BAD_REQUEST) +# if 'member3' in request.data: +# try: +# user3 = User.objects.get(username=request.data['member3']) +# member3 = user3.extrainfo +# request.data['member3'] = member3 +# except: +# return Response({'error':'Wrong username of member 3. User does not exist.'}, status=status.HTTP_400_BAD_REQUEST) +# else: +# member3 = None +# if not 'approval' in request.data: +# return Response({'error':'Approval value is required.'}, status=status.HTTP_400_BAD_REQUEST) +# elif request.data['approval'] != 'yes' and request.data['approval'] != 'no': +# return Response({'error':'Wrong approval value provided. Approval value should be yes or no'}, status=status.HTTP_400_BAD_REQUEST) +# if request.data['approval'] == 'yes': +# request.data.pop('approval', None) +# request.data['pending_supervisor'] = False +# request.data['approval_supervisor'] = True +# request.data['forwarded_to_hod'] = True +# request.data['pending_hod'] = True +# else: +# request.data.pop('approval', None) +# request.data['pending_supervisor'] = False +# request.data['approval_supervisor'] = False +# request.data['forwarded_to_hod'] = False +# request.data['pending_hod'] = False +# serializer = serializers.ThesisTopicProcessSerializer(thesis, data=request.data, partial=True) +# if serializer.is_valid(): +# serializer.save() +# return Response(serializer.data, status=status.HTTP_200_OK) +# else: +# return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) +# else: +# return Response({'error':'Cannot approve thesis'}, status=status.HTTP_400_BAD_REQUEST) \ No newline at end of file diff --git a/FusionIIIT/applications/academic_procedures/models.py b/FusionIIIT/applications/academic_procedures/models.py index 37b339378..4a932832f 100644 --- a/FusionIIIT/applications/academic_procedures/models.py +++ b/FusionIIIT/applications/academic_procedures/models.py @@ -565,8 +565,6 @@ class StudentRegistrationChecks(models.Model): final_registration_flag(boolean) - to denote whether the final registration is complete semester_id(programme_curriculum.Semester) - reference to the semester for which the registration will be considered - - ''' @@ -618,9 +616,6 @@ class FinalRegistration(models.Model): verified(Boolean) - denotes whether the registration is verified by academic department and complete course_slot_id(programme_curriculum.CourseSlot) - details about under which course slot the course is offered(Optional/Core other details) - - - ''' @@ -671,16 +666,12 @@ class course_registration(models.Model): ''' Current Purpose : stores information regarding the process of registration of a student for a course - ATTRIBUTES course_id(programme_curriculum.Course) - reference to the course details for which the registration is being done semester_id(programme_curriculum.Semester) - reference to the semester for which the course registration is done student_id(academic_information.Student) - reference to the student course_slot_id(programme_curriculum.CourseSlot) - details about under which course slot the course is offered(Optional/Core other details) - - - ''' @@ -694,3 +685,19 @@ class course_registration(models.Model): class Meta: db_table = 'course_registration' + + +class backlog_course(models.Model): + ''' + Current Purpose : stores information regarding the backlog courses of a student (purpose is unclear and is open to interpretations) + + ATTRIBUTES + course_id(programme_curriculum.Course) - reference to the course details for which the registration is being done + semester_id(programme_curriculum.Semester) - reference to the semester for which the course registration is done + student_id(academic_information.Student) - reference to the student + is_summer_course(Boolean) - details about whether this course is available as summer_course or not + ''' + student_id = models.ForeignKey(Student, on_delete=models.CASCADE) + semester_id = models.ForeignKey(Semester, on_delete=models.CASCADE) + course_id = models.ForeignKey(Course, on_delete=models.CASCADE) + is_summer_course = models.BooleanField(default= False) \ No newline at end of file diff --git a/FusionIIIT/applications/academic_procedures/tests.py b/FusionIIIT/applications/academic_procedures/tests.py index e9137c85e..2c9e754ad 100644 --- a/FusionIIIT/applications/academic_procedures/tests.py +++ b/FusionIIIT/applications/academic_procedures/tests.py @@ -1,3 +1,4 @@ # from django.test import TestCase # Create your tests here. + diff --git a/FusionIIIT/applications/academic_procedures/urls.py b/FusionIIIT/applications/academic_procedures/urls.py index 45f892b49..a61a569b3 100644 --- a/FusionIIIT/applications/academic_procedures/urls.py +++ b/FusionIIIT/applications/academic_procedures/urls.py @@ -1,5 +1,4 @@ from django.conf.urls import url, include - from . import views appname = 'procedures' urlpatterns = [ @@ -7,19 +6,23 @@ url(r'^main/', views.academic_procedures, name='procedures'), url(r'^register/', views.register, name='register'), url(r'^pre_registration/', views.pre_registration, name='pre_register'), + url(r'^auto_pre_registration/', views.auto_pre_registration, name='automatic_pre_register'), + url(r'^final_registration/', views.final_registration, name='final_register'), url(r'^addCourse/', views.add_courses, name='addCourse'), + url(r'^add_one_course/' , views.add_one_course , name = 'add_one_course'), url(r'^drop_course/', views.drop_course, name='drop_course'), + url(r'^replaceCourse/', views.replace_courses, name='replace_courses'), + url(r'^replace_one_course/', views.replace_one_course, name='replace_one_course'), url(r'^branch-change/', views.approve_branch_change, name='branch_change'), url(r'^brach-change-request/', views.branch_change_request, name='branch_change_request'), + url(r'^acad_person/verifyCourse/drop/$',views.dropcourseadmin, name='dropcourseadmin'), url(r'^acad_person/verifyCourse/', views.verify_course, name='verifyCourse'), url(r'^acad_person/addCourse/', views.acad_add_course, name="acad_add_course"), url(r'^acad_person/student_list$', views.student_list, name='studentlist'), url(r'^acad_person/course_list$', views.course_list, name='courseList'), url(r'^acad_person/$', views.acad_person, name='acad_person'), - url(r'^acad_person/verifyCourse/drop/$', - views.dropcourseadmin, name='dropcourseadmin'), url(r'^branch-validate', views.approve_branch_change, name='branch_validate'), url(r'^acad_person/branch_change/$', views.acad_branch_change, name='acad_branch_change'), @@ -28,6 +31,7 @@ url(r'^account/$', views.account), url(r'^addThesis/$', views.add_thesis, name='add_thesis'), url(r'^process_verification_request/$', views.process_verification_request), + url(r'^auto_process_verification_request/$', views.auto_process_verification_request), url(r'^teaching_credit/$', views.teaching_credit_register), url(r'^course_marks_data/$', views.course_marks_data), # -- url(r'^submit_marks/$', views.submit_marks), # -- @@ -41,7 +45,10 @@ url(r'^test/$', views.test), url(r'^bonafide_pdf/$', views.Bonafide_form), url(r'^test_ret/$', views.test_ret), + url(r'^api/', include('applications.academic_procedures.api.urls')), + + url(r'^faculty_data/$', views.facultyData, name='faculty_data'), url(r'^ACF/$', views.ACF, name='ACF'), url(r'^MTSGF/$', views.MTSGF), @@ -51,12 +58,19 @@ url(r'^update_phdform/$', views.update_phdform), url(r'^update_dues/$', views.update_dues), url(r'^dues_pdf/$', views.dues_pdf), - url(r'^acad_person/gen_course_list$', - views.gen_course_list, name='gen_course_list'), + url(r'^acad_person/gen_course_list$', views.gen_course_list, name='gen_course_list'), url(r'^update_acad_assistantship/$', views.update_acad_assis), url(r'^update_account_assistantship/$', views.update_account_assistantship), url(r'^update_hod_assistantship/$', views.update_hod_assistantship), url(r'^mdue/$', views.mdue), url(r'^assis_stat/$', views.assis_stat), - url(r'^acad_person/allot_courses/' , views.allot_courses, name='allot_courses') + url(r'^acad_person/allot_courses/' , views.allot_courses, name='allot_courses'), + + url(r'^acad_person/get_next_sem_courses/' , views.get_next_sem_courses , name = 'get_next_sem_courses'), + + url(r'^acad_person/remove_course_from_slot/' , views.remove_course_from_slot , name = 'remove_course_from_slot'), + url(r'^acad_person/add_course_to_slot/' , views.add_course_to_slot , name = 'add_course_to_slot'), + url(r'^acad_person/replaceSwayam/', views.replaceSwayam, name='replaceSwayam'), + url(r'^acad_person/swayam_replace/', views.swayam_replace, name='swayam_replace'), + ] diff --git a/FusionIIIT/applications/academic_procedures/views.py b/FusionIIIT/applications/academic_procedures/views.py index 7e55e3e45..dc53e35f1 100644 --- a/FusionIIIT/applications/academic_procedures/views.py +++ b/FusionIIIT/applications/academic_procedures/views.py @@ -11,6 +11,7 @@ import logging from django.db import transaction from django.contrib import messages +from django.db.models import Q from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.db.models import Max,Value,IntegerField,CharField,F,Sum @@ -29,16 +30,21 @@ from applications.programme_curriculum.models import (CourseSlot, Course as Courses, Batch, Semester , CourseInstructor) from applications.globals.models import (DepartmentInfo, Designation, ExtraInfo, Faculty, HoldsDesignation) - +from applications.programme_curriculum.models import Course as Courses from .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) + PhDProgressExamination,CourseRequested, course_registration, MessDue, Assistantship_status , backlog_course) from notification.views import academics_module_notif from .forms import BranchChangeForm from django.db.models.functions import Concat,ExtractYear,ExtractMonth,ExtractDay,Cast +from .api import serializers +from django.core.serializers import serialize + +"""every newfuncitons that have been created with name auto_ in start of their original name is to implement new logic of registraion .. +unlike the previous registration logic that was done with priority """ demo_date = timezone.now() @@ -53,12 +59,7 @@ available_ece_seats = 100 available_me_seats = 100 -# assistantship_status = Assistantship_status.objects.all() -# for obj in assistantship_status: -# student_status = obj.student_status -# hod_status = obj.hod_status -# account_status = obj.account_status @login_required(login_url='/accounts/login') @@ -158,6 +159,15 @@ def academic_procedures_faculty(request): mtechseminar_request_list = MTechGraduateSeminarReport.objects.all().filter(Overall_grade = '') phdprogress_request_list = PhDProgressExamination.objects.all().filter(Overall_grade = '') courses_list = list(CourseInstructor.objects.select_related('course_id', 'batch_id', 'batch_id__discipline').filter(instructor_id__id=fac_id.id).only('course_id__code', 'course_id__name', 'batch_id')) + + assigned_courses = CourseInstructor.objects.select_related('course_id', 'batch_id', 'batch_id__discipline').filter( + instructor_id__id=fac_id.id, # Filter by faculty ID + batch_id__running_batch=True, # Filter by currently running batches + course_id__working_course=True # Filter by currently active courses + ).only('course_id__code', 'course_id__name', 'batch_id') + assigned_courses = list(assigned_courses) + + # print('------------------------------------------------------------------------------------------------------------------' , list(assigned_courses)) r = range(4) return render( request, @@ -181,6 +191,7 @@ def academic_procedures_faculty(request): 'mtechseminar_request_list' : mtechseminar_request_list, 'phdprogress_request_list' : phdprogress_request_list, 'r' : r, + 'assigned_courses' : assigned_courses, }) else: HttpResponse("user not found") @@ -341,17 +352,23 @@ def academic_procedures_student(request): currently_registered_course = get_currently_registered_course(obj,obj.curr_semester_no) current_credits = get_current_credits(currently_registered_course) - + cur_cpi=0.0 details = { 'current_user': current_user, 'year': acad_year, - 'user_sem': user_sem, + 'user_sem': user_sem - 1, 'user_branch' : str(user_branch), 'cpi' : cpi, } cur_cpi=details['cpi'] + swayam_courses_count = 0 + next_sem_student = user_sem + 1 + if(next_sem_student > 2): + swayam_courses_count = 2 + if(next_sem_student == 6 or next_sem_student == 7 or next_sem_student == 8): + swayam_courses_count = 3 try: pre_registered_courses = InitialRegistration.objects.all().filter(student_id = user_details.id,semester_id = next_sem_id) @@ -374,13 +391,14 @@ def academic_procedures_student(request): for final_registered_course in final_registered_courses: final_registered_course_show.append({"course_code":final_registered_course.course_id.code,"course_name":final_registered_course.course_id.name,"course_credit":final_registered_course.course_id.credit}) add_courses_options = get_add_course_options(current_sem_branch_course, currently_registered_course, batch.year) - #drop_courses_options = get_drop_course_options(currently_registered_course) - + drop_courses_options = get_drop_course_options(currently_registered_course) + replace_courses_options = get_replace_course_options(currently_registered_course, batch.year) except Exception as e: final_registered_courses = None final_registered_course_show = None - #drop_courses_options = None + # drop_courses_options = None add_courses_options = None + replace_courses_options = None fee_payment_mode_list = dict(Constants.PaymentMode) @@ -455,6 +473,13 @@ def academic_procedures_student(request): attendence.append((i,pr,pr+ab)) cur_spi='Sem results not available' # To be fetched from db if result uploaded + backlogCourseList = [] + backlogCourses = backlog_course.objects.select_related('course_id' , 'student_id' , 'semester_id' ).filter(student_id=obj) + for i in backlogCourses: + summer_course = "Yes" if i.is_summer_course else "No" + course_details = i.course_id.course_details if i.course_id.course_details else "N/A" + + backlogCourseList.append([i.course_id.course_name, course_details , i.semester_id.semester_no , summer_course]) Mess_bill = Monthly_bill.objects.filter(student_id = obj) Mess_pay = Payments.objects.filter(student_id = obj) @@ -503,7 +528,8 @@ def academic_procedures_student(request): # 'change_branch': change_branch, # 'add_course': add_course, 'add_courses_options': add_courses_options, - #'drop_courses_options' : drop_courses_options, + 'drop_courses_options' : drop_courses_options, + 'replace_courses_options' : replace_courses_options, # 'pre_register': pre_register, 'pre_registration_timestamp': pre_registration_timestamp, 'prd': pre_registration_date_flag, @@ -512,6 +538,7 @@ def academic_procedures_student(request): 'adc_date_flag': add_or_drop_course_date_flag, 'pre_registration_flag' : pre_registration_flag, 'final_registration_flag': final_registration_flag, + 'swayam_courses_count':swayam_courses_count, # 'final_r': final_register_1, 'teaching_credit_registration_course' : teaching_credit_registration_course, @@ -527,6 +554,7 @@ def academic_procedures_student(request): 'hos_d':hos_d, 'tot_d':tot_d, 'attendence':attendence, + 'backlogCourseList' : backlogCourseList, 'BranchChangeForm': BranchChangeForm(), 'BranchFlag':branchchange_flag, 'assistantship_flag' : student_status, @@ -852,12 +880,16 @@ def dropcourseadmin(request): ''' data = request.GET.get('id') data = data.split(" - ") + student_id = data[0] course_code = data[1] + course = Courses.objects.get(code=course_code , version = 1.0) # need to add batch and programme - curriculum_object = Curriculum.objects.all().filter(course_code = course_code) + # curriculum_object = Curriculum.objects.all().filter(course_code = course_code) try: - Register.objects.filter(curr_id = curriculum_object.first(),student_id=int(data[0])).delete() - except: + # Register.objects.filter(curr_id = curriculum_object.first(),student_id=int(data[0])).delete() + course_registration.objects.filter(student_id = student_id , course_id = course.id).delete() + except Exception as e: + print(str(e)) pass # print("hello ") response_data = {} @@ -932,9 +964,12 @@ def verify_course(request): 'firstname': firstname, 'lastname': lastname} obj2 = Student.objects.all().select_related( 'id', 'id__user', 'id__department').filter(id=roll_no).first() - obj = Register.objects.all().select_related('curr_id', 'student_id', 'curr_id__course_id', - 'student_id__id', 'student_id__id__user', 'student_id__id__department').filter(student_id=obj2) - curr_sem_id = obj2.curr_semester_no + # obj = Register.objects.all().select_related('curr_id', 'student_id', 'curr_id__course_id', + # 'student_id__id', 'student_id__id__user', 'student_id__id__department').filter(student_id=obj2) + batch = obj2.batch_id + curr_id = batch.curriculum + curr_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = obj2.curr_semester_no) + # curr_sem_id = obj2.curr_semester_no details = [] current_sem_courses = get_currently_registered_course( @@ -943,7 +978,10 @@ def verify_course(request): idd = obj2 for z in current_sem_courses: z = z[1] - course_code, course_name = str(z).split(" - ") + print(z) + course_code = z.code + course_name = z.name + # course_code, course_name = str(z).split(" - ") k = {} # reg_ig has course registration id appended with the the roll number # so that when we have removed the registration we can be redirected to this view @@ -955,7 +993,7 @@ def verify_course(request): for p in courseobj2: k['course_id'] = course_code k['course_name'] = course_name - k['sem'] = curr_sem_id + k['sem'] = curr_sem_id.semester_no k['credits'] = p.credit details.append(k) @@ -971,6 +1009,9 @@ def verify_course(request): date = {'year': yearr, 'semflag': semflag} course_list = Courses.objects.all() semester_list = Semester.objects.all() + semester_no_list=[] + for i in semester_list: + semester_no_list.append(int(i.semester_no)) html = render_to_string('academic_procedures/studentCourses.html', {'details': details, 'dict2': dict2, @@ -1368,7 +1409,77 @@ def pre_registration(request): else: return HttpResponseRedirect('/academic-procedures/main') +@login_required(login_url='/accounts/login') +@transaction.atomic +def auto_pre_registration(request): + if request.method == 'POST': + try: + current_user = get_object_or_404(User, username=request.POST.get('user')) + current_user = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() + current_user = Student.objects.all().filter(id=current_user.id).first() + sem_id = Semester.objects.get(id = request.POST.get('semester')) + + course_slots=request.POST.getlist("course_slot") + try: + student_registeration_check=get_student_registrtion_check(current_user,sem_id) + if(student_registeration_check and student_registeration_check.pre_registration_flag==True): + messages.error(request,"You have already registered for next semester") + return HttpResponseRedirect('/academic-procedures/main') + except Exception as e: + print(e) + + reg_curr = [] + final_reg_curr = [] + existing_entries = set() + for course_slot in course_slots : + course_priorities = request.POST.getlist("course_priority-"+course_slot) + if(course_priorities[0] == 'NULL'): + continue + course_slot_id_for_model = CourseSlot.objects.get(id = int(course_slot)) + print("=----> course_priorities ----- ",course_priorities) + print("------------>course slot id ",course_slot_id_for_model) + for course_priority in course_priorities: + if(course_priority == 'NULL'): + continue + priority_of_current_course,course_id = map(int,course_priority.split("-")) + course_id_for_model = Courses.objects.get(id = course_id) + current_combination = (course_slot_id_for_model.id, course_id_for_model.id) + if current_combination not in existing_entries: + p = InitialRegistration( + course_id = course_id_for_model, + semester_id = sem_id, + student_id = current_user, + course_slot_id = course_slot_id_for_model, + priority = priority_of_current_course + ) + f =FinalRegistration(student_id=current_user ,course_slot_id=course_slot_id_for_model , course_id=course_id_for_model ,semester_id=sem_id) + final_reg_curr.append(f) + reg_curr.append(p) + existing_entries.add(current_combination) + try: + + InitialRegistration.objects.bulk_create(reg_curr) + FinalRegistration.objects.bulk_create(final_reg_curr) + registration_check = StudentRegistrationChecks( + student_id = current_user, + pre_registration_flag = True, + final_registration_flag = False, + semester_id = sem_id + ) + registration_check.save() + messages.info(request, 'Successfully Registered.') + messages.success(request, "Successfully Registered.") + return HttpResponseRedirect('/academic-procedures/stu') + except Exception as e: + messages.error(request, "Error in Registration.") + return HttpResponseRedirect('/academic-procedures/stu') + except Exception as e: + messages.error(request, "Error in Registration.") + return HttpResponseRedirect('/academic-procedures/main') + else: + return HttpResponseRedirect('/academic-procedures/main') + def get_student_registrtion_check(obj, sem): return StudentRegistrationChecks.objects.all().filter(student_id = obj, semester_id = sem).first() @@ -1428,24 +1539,31 @@ def allot_courses(request): profiles=request.FILES['allotedCourses'] batch_id=request.POST['batch'] sem_no=int(request.POST['semester']) - + batch=Batch.objects.get(id=batch_id) sem_id=Semester.objects.get(curriculum=batch.curriculum,semester_no=sem_no) - + print(batch , sem_id) + # format of excel sheet being uploaded should be xls only , otherwise error excel = xlrd.open_workbook(file_contents=profiles.read()) sheet=excel.sheet_by_index(0) final_registrations=[] + # print('>>>>>>>>>>>>>>>>>>>' , sheet.nrows) for i in range(1,sheet.nrows): roll_no = str(sheet.cell(i,0).value).split(".")[0] + # print("Roll No from Excel:", roll_no) course_slot_name = sheet.cell_value(i,1) course_code = sheet.cell_value(i,2) course_name = sheet.cell_value(i,3) - user=User.objects.get(username=roll_no) - 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) - course = Courses.objects.get(code=course_code.strip(),name=course_name.strip()) - #print(">>>>>",roll_no,course_slot_name,course_code,course_name) + try: + user=User.objects.get(username=roll_no) + 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()) + # print(">>>>>",roll_no,course_slot_name,course_code,course_name) + except Exception as e: + print('----------------------' , e) final_registration=FinalRegistration(student_id=student,course_slot_id=course_slot, course_id=course,semester_id=sem_id) final_registrations.append(final_registration) @@ -1627,6 +1745,52 @@ def drop_course(request): else: return HttpResponseRedirect('/academic-procedures/main') +def replace_courses(request): + """ + This function is used to replace elective courses which have been registered + @param: + request - contains metadata about the requested page + @variables: + current_user - contains current logged in user + sem_id - contains current semester id + count - no of courses to be replaced + course_id - contains course id for a particular course + course_slot_id - contains course slot id for a particular course + choice - contains choice of a particular course + slot - contains slot of a particular course + """ + + if request.method == 'POST' : + try: + current_user = get_object_or_404(User, username=request.POST.get('user')) + current_user = ExtraInfo.objects.all().filter(user=current_user).first() + current_user = Student.objects.all().filter(id=current_user.id).first() + + # sem_id = Semester.objects.get(id = request.POST.get('semester')) + count = request.POST.get('ct') + count = int(count) + + for i in range(1, count+1): + choice = "choice["+str(i)+"]" + slot = "slot["+str(i)+"]" + try : + + course_id = Courses.objects.get(id = request.POST.get(choice)) + courseslot_id = CourseSlot.objects.get(id = request.POST.get(slot)) + + registered_course = course_registration.objects.filter(student_id=current_user, course_slot_id = courseslot_id).first() + + if registered_course: + registered_course.course_id = course_id + registered_course.save() + except Exception as e: + continue + return HttpResponseRedirect('/academic-procedures/main') + except Exception as e: + return HttpResponseRedirect('/academic-procedures/main') + else : + return HttpResponseRedirect('/academic-procedures/main') + @@ -1726,7 +1890,7 @@ def get_final_registration_choices(branch_courses,batch): max_limit = courseslot.max_registration_limit lis = [] for course in courseslot.courses.all(): - if FinalRegistration .objects.filter(student_id__batch_id__year = batch, course_id = course).count() < max_limit: + if FinalRegistration.objects.filter(student_id__batch_id__year = batch, course_id = course).count() < max_limit: lis.append(course) else: unavailable_courses.append(course) @@ -1757,7 +1921,24 @@ def get_drop_course_options(current_register): courses.append(item[1]) return courses +def get_replace_course_options( current_register, batch): + replace_options = [] + + for registered_course in current_register: + courseslot_id = registered_course[0] + course_id = registered_course[1] + + courseslot = courseslot_id + coursename = course_id.name + lis = [] + + if 'Elective' in courseslot.type: + for course in courseslot.courses.all(): + if course != course_id: + lis.append(course) + replace_options.append((courseslot, coursename, lis)) + return replace_options @@ -1789,7 +1970,11 @@ def get_user_semester(roll_no, ug_flag, masters_flag, phd_flag): def get_branch_courses(roll_no, user_sem, branch): roll = str(roll_no) - year = int(roll[:4]) + try: + year = int(roll[:4]) + except: + year = int(roll[:2]) + year = 2000 + year courses = Curriculum.objects.all().select_related().filter(batch=(year)) courses = courses.filter(sem = user_sem) courses = courses.filter(floated = True) @@ -2223,12 +2408,13 @@ def student_list(request): batch_id = Batch.objects.get(id = batch) student_obj = FeePayments.objects.all().select_related('student_id').filter(student_id__batch_id = batch_id) if (student_obj): - reg_table = student_obj.prefetch_related('student_id__studentregistrationchecks').filter(semester_id = student_obj[0].semester_id, student_id__studentregistrationchecks__final_registration_flag = True).select_related( + reg_table = student_obj.prefetch_related('student_id__studentregistrationchecks').filter(semester_id = student_obj[0].semester_id, student_id__studentregistrationchecks__final_registration_flag = True , student_id__finalregistration__verified=False , student_id__finalregistration__semester_id= student_obj[0].semester_id ).select_related( 'student_id','student_id__id','student_id__id__user','student_id__id__department').values( 'student_id__id','student_id__id__user__first_name','student_id__id__user__last_name','student_id__batch','student_id__id__department__name', 'student_id__programme','student_id__curr_semester_no','student_id__id__sex','student_id__id__phone_no','student_id__category', 'student_id__specialization','mode','transaction_id','deposit_date','fee_paid','utr_number','reason','fee_receipt','actual_fee', - 'student_id__id__user__username').order_by('student_id__id__user') + 'student_id__id__user__username').order_by('student_id__id__user').distinct() + # print('------------------------------------------------------------------------------------------------------------------------------------------',reg_table) else : reg_table = [] @@ -2288,7 +2474,7 @@ def student_list(request): 'specialization','gender','category', 'pwd_status','phone_no','actual_fee', 'fee_paid','reason','date_deposited', - 'mode','utr_number','fee_receipt')) + 'mode','utr_number','fee_receipt')).distinct() excel_response = BytesIO() @@ -2326,6 +2512,12 @@ def process_verification_request(request): return verify_registration(request) return JsonResponse({'status': 'Failed'}, status=400) + +def auto_process_verification_request(request): + if request.is_ajax(): + return auto_verify_registration(request) + return JsonResponse({'status': 'Failed'}, status=400) + @transaction.atomic def verify_registration(request): @@ -2335,12 +2527,17 @@ def verify_registration(request): batch = student.batch_id curr_id = batch.curriculum - sem_id = Semester.objects.get(curriculum = curr_id, semester_no = student.curr_semester_no+1) + + if(student.curr_semester_no+1 >= 9): + sem_no = 4 + else: + sem_no = student.curr_semester_no+1 - final_register_list = FinalRegistration.objects.all().filter(student_id = student, verified = False, semester_id = sem_id) + sem_id = Semester.objects.get(curriculum = curr_id, semester_no = sem_no) - sem_no = student.curr_semester_no + 1 + final_register_list = FinalRegistration.objects.all().filter(student_id = student, verified = False, semester_id = sem_id) + with transaction.atomic(): ver_reg = [] for obj in final_register_list: @@ -2353,6 +2550,7 @@ def verify_registration(request): ver_reg.append(p) o = FinalRegistration.objects.filter(id= obj.id).update(verified = True) course_registration.objects.bulk_create(ver_reg) + # StudentRegistrationChecks.objects.filter(student_id = student_id, semester_id = sem_id).update(final_registration_flag = True) academics_module_notif(request.user, student.id.user, 'registration_approved') Student.objects.filter(id = student_id).update(curr_semester_no = sem_no) return JsonResponse({'status': 'success', 'message': 'Successfully Accepted'}) @@ -2363,8 +2561,11 @@ def verify_registration(request): batch = student_id.batch_id curr_id = batch.curriculum - sem_id = Semester.objects.get(curriculum = curr_id, semester_no = student_id.curr_semester_no + 1) - + if(student.curr_semester_no+1 >= 9): + sem_no = 4 + else: + sem_no = student.curr_semester_no+1 + sem_id = Semester.objects.get(curriculum = curr_id, semester_no = sem_no) with transaction.atomic(): academicadmin = get_object_or_404(User, username = "acadadmin") FinalRegistration.objects.filter(student_id = student_id, verified = False, semester_id = sem_id).delete() @@ -2373,8 +2574,53 @@ def verify_registration(request): academics_module_notif(academicadmin, student_id.id.user, 'Registration Declined - '+reject_reason) return JsonResponse({'status': 'success', 'message': 'Successfully Rejected'}) - - +@transaction.atomic +def auto_verify_registration(request): + if request.POST.get('status_req') == "accept" : + student_id = request.POST.get('student_id') + student = Student.objects.get(id = student_id) + batch = student.batch_id + curr_id = batch.curriculum + + if(student.curr_semester_no+1 >= 9): + # print('----------------------------------------------------------------' , student.curr_semester_no) + sem_no = 8 + else: + # print('----------------------------------------------------------------' , student.curr_semester_no) + sem_no = student.curr_semester_no+1 + sem_id = Semester.objects.get(curriculum = curr_id, semester_no = sem_no) + # print('----------------------------------------------------------------' , student.curr_semester_no) + + final_register_list = FinalRegistration.objects.all().filter(student_id = student, verified = False, semester_id = sem_id) + + # final_register_list = FinalRegistration.objects.all().filter(student_id = student, verified = False) + + with transaction.atomic(): + for obj in final_register_list: + o = FinalRegistration.objects.filter(id= obj.id).update(verified = True) + academics_module_notif(request.user, student.id.user, 'registration_approved') + + Student.objects.filter(id = student_id).update(curr_semester_no = sem_no) + return JsonResponse({'status': 'success', 'message': 'Successfully Accepted'}) + + elif request.POST.get('status_req') == "reject" : + reject_reason = request.POST.get('reason') + student_id = request.POST.get('student_id') + student_id = Student.objects.get(id = student_id) + batch = student_id.batch_id + curr_id = batch.curriculum + if(student_id.curr_semester_no+1 >= 9): + sem_no = 8 + else: + sem_no = student_id.curr_semester_no+1 + sem_id = Semester.objects.get(curriculum = curr_id, semester_no = sem_no) + with transaction.atomic(): + academicadmin = get_object_or_404(User, username = "acadadmin") + FinalRegistration.objects.filter(student_id = student_id, verified = False, semester_id = sem_id).delete() + StudentRegistrationChecks.objects.filter(student_id = student_id, semester_id = sem_id).update(final_registration_flag = False) + FeePayments.objects.filter(student_id = student_id, semester_id = sem_id).delete() + academics_module_notif(academicadmin, student_id.id.user, 'Registration Declined - '+reject_reason) + return JsonResponse({'status': 'success', 'message': 'Successfully Rejected'}) def get_registration_courses(courses): x = [[]] @@ -2439,8 +2685,8 @@ def course_marks_data(request): try: course_id = request.POST.get('course_id') course = Courses.objects.select_related().get(id = course_id) - print(course) - print(course_id) + # print(course) + # print(course_id) student_list = course_registration.objects.filter(course_id__id=course_id).select_related( 'student_id__id__user','student_id__id__department').only('student_id__batch', 'student_id__id__user__first_name', 'student_id__id__user__last_name', @@ -3462,7 +3708,355 @@ def mdue(request): content = json.dumps("success") return HttpResponse(content) + + + +def get_detailed_sem_courses(sem_id): + course_slots = CourseSlot.objects.filter(semester_id=sem_id) + # Serialize queryset of course slots into JSON + course_slots_json = serialize('json', course_slots) + # Convert JSON string into Python object + course_slots_data = json.loads(course_slots_json) + + # Iterate over each course slot data and include associated course data + for slot_data in course_slots_data: + # Retrieve associated courses for the current course slot + slot = CourseSlot.objects.get(id=slot_data['pk']) + courses = list(slot.courses.all().values()) + # Add courses data to the course slot data + slot_data['courses'] = courses + + return course_slots_data + + +def get_next_sem_courses(request): + if request.method == 'POST': + data = json.loads(request.body) + next_sem = data.get('next_sem') + branch = data.get('branch') + programme = data.get('programme') + batch = data.get('batch') + # we go to student table and apply filters and get batch_id of the students with these filter + batch_id = Student.objects.filter(programme = programme , batch = batch , specialization = branch)[0].batch_id + + curr_id = batch_id.curriculum + # print('-----------------------------------------------------------------------------------------', curr_id) + # curr_id = 1 + next_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = next_sem) + if next_sem_id: + next_sem_registration_courses = get_detailed_sem_courses(next_sem_id ) + # print(next_sem_registration_courses) + return JsonResponse(next_sem_registration_courses, safe=False) + return JsonResponse({'error': 'Invalid request'}) + + +def add_course_to_slot(request): + if request.method == 'POST': + data = json.loads(request.body) + course_slot_name = data.get('course_slot_name') + course_code = data.get('course_name') + # print('-----------------------------------------------------------------------------------------' , course_slot_name , course_code) + try: + course_slot = CourseSlot.objects.get(name=course_slot_name) + course = Courses.objects.get(code=course_code) + course_slot.courses.add(course) + + return JsonResponse({'message': f'Course {course_code} added to slot {course_slot_name} successfully.'}, status=200) + except CourseSlot.DoesNotExist: + return JsonResponse({'error': 'Course slot does not exist.'}, status=400) + except Course.DoesNotExist: + return JsonResponse({'error': 'Course does not exist.'}, status=400) + + return JsonResponse({'error': 'Invalid request method.'}, status=405) + + +def remove_course_from_slot(request): + if request.method == 'POST': + data = json.loads(request.body) + course_slot_name = data.get('course_slot_name') + course_code = data.get('course_name') + # print('-----------------------------------------------------------------------------------------' , course_slot_name , course_code) + try: + course_slot = CourseSlot.objects.get(name=course_slot_name) + course = Courses.objects.get(code=course_code) + course_slot.courses.remove(course) + return JsonResponse({'message': f'Course {course_code} removed from slot {course_slot_name} successfully.'}, status=200) + except CourseSlot.DoesNotExist: + return JsonResponse({'error': 'Course slot does not exist.'}, status=400) + except Course.DoesNotExist: + return JsonResponse({'error': 'Course does not exist.'}, status=400) + + return JsonResponse({'error': 'Invalid request method.'}, status=405) + + +def add_one_course(request): + if request.method == 'POST': + try: + # print(request.POST) + current_user = get_object_or_404(User, username=request.POST.get('user')) + current_user = ExtraInfo.objects.all().filter(user=current_user).first() + current_user = Student.objects.all().filter(id=current_user.id).first() + + sem_id = Semester.objects.get(id=request.POST.get('semester')) + choice = request.POST.get('choice') + slot = request.POST.get('slot') + + try: + course_id = Courses.objects.get(id=choice) + courseslot_id = CourseSlot.objects.get(id=slot) + print(courseslot_id) + print(courseslot_id.type) + if course_registration.objects.filter(course_slot_id_id=courseslot_id, student_id=current_user).count() == 1 and courseslot_id.type != "Swayam": + already_registered_course_id = course_registration.objects.filter(course_slot_id_id=courseslot_id, student_id=current_user)[0].course_id + # print(already_registered_course_id) + msg = 'Already Registered in the course : ' +already_registered_course_id.code + '-'+ already_registered_course_id.name + return JsonResponse({'message' : msg}) + if((course_registration.objects.filter(course_id=course_id, student_id=current_user).count() >= 1)): + return JsonResponse({'message': 'Already registered in this course!'}, status=200) + # Check if maximum course registration limit has not been reached + if course_registration.objects.filter(student_id__batch_id__year=current_user.batch_id.year, course_id=course_id).count() < courseslot_id.max_registration_limit and \ + (course_registration.objects.filter(course_id=course_id, student_id=current_user).count() == 0): + p = course_registration( + course_id=course_id, + student_id=current_user, + course_slot_id=courseslot_id, + semester_id=sem_id + ) + p.save() + return JsonResponse({'message': 'Course added successfully'}) + else: + return JsonResponse({'message': 'Course not added because seats are full!'}, status=200) + except Exception as e: + return JsonResponse({'message': 'Error adding course'}, status=500) + except Exception as e: + return JsonResponse({'message': 'Error adding course'}, status=500) + else: + return JsonResponse({'message': 'Invalid request method'}, status=405) + +def replace_one_course(request): + if request.method == 'POST' : + try: + current_user = get_object_or_404(User, username=request.POST.get('user')) + current_user = ExtraInfo.objects.all().filter(user=current_user).first() + current_user = Student.objects.all().filter(id=current_user.id).first() + + course_id = Courses.objects.get(id = request.POST.get('choice')) + courseslot_id = CourseSlot.objects.get(id = request.POST.get('slot')) + if course_registration.objects.filter(student_id__batch_id__year=current_user.batch_id.year, course_id=course_id).count() < courseslot_id.max_registration_limit and \ + (course_registration.objects.filter(course_id=course_id, student_id=current_user).count() == 0): + # print('---------------------------------------------------------------------------------' , course_registration.objects.filter(student_id__batch_id__year=current_user.batch_id.year, course_id=course_id).count() , courseslot_id.max_registration_limit ) + registered_course = course_registration.objects.filter(student_id=current_user, course_slot_id = courseslot_id).first() + if registered_course: + registered_course.course_id = course_id + registered_course.save() + else: + return JsonResponse({'message': 'Cannot Replace to this course seats are full!'}, status=200) + + return JsonResponse({'message': 'Course Replaced Successfully'}, status=200) + except Exception as e: + return JsonResponse({'message': 'Error Replacing course'}, status=500) + else : + return JsonResponse({'message': 'Invalid request method'}, status=405) + +def get_sem_swayam(sem_id, batch): + courses = [] + course_slots = CourseSlot.objects.all().filter(type='Swayam') + + for slot in course_slots: + courses.append(slot) + + return courses + +def replaceSwayam(request): + if(request.POST): + # print(f"++++++++++++++++++++++++++++++++++++++++++++++++{request.POST}") + current_user = get_object_or_404(User, username=request.user.username) + user_details = ExtraInfo.objects.all().select_related( + 'user', 'department').filter(user=current_user).first() + desig_id = Designation.objects.all().filter(name='adminstrator').first() + temp = HoldsDesignation.objects.all().select_related().filter( + designation=desig_id).first() + acadadmin = temp.working + k = str(user_details).split() + final_user = k[2] + + if (str(acadadmin) != str(final_user)): + return HttpResponseRedirect('/academic-procedures/') + roll_no = request.POST["rollNo"] + obj = ExtraInfo.objects.all().select_related( + 'user', 'department').filter(id=roll_no).first() + firstname = obj.user.first_name + lastname = obj.user.last_name + dict2 = {'roll_no': roll_no, + 'firstname': firstname, 'lastname': lastname} + + + details = [] + + obj2 = Student.objects.all().select_related( + 'id', 'id__user', 'id__department').filter(id=roll_no).first() + # obj = Register.objects.all().select_related('curr_id', 'student_id', 'curr_id__course_id', + # 'student_id__id', 'student_id__id__user', 'student_id__id__department').filter(student_id=obj2) + batch = obj2.batch_id + curr_id = batch.curriculum + curr_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = obj2.curr_semester_no) + + current_sem_courses = get_currently_registered_elective( + roll_no, curr_sem_id) + current_sem_swayam = get_sem_swayam(curr_sem_id,2025) + + idd = obj2 + for z in current_sem_courses: + eletive_id=z[2] + z = z[1] + + course_code = z.code + course_name = z.name + + k = {} + # reg_ig has course registration id appended with the the roll number + # so that when we have removed the registration we can be redirected to this view + k['reg_id'] = roll_no+" - "+course_code + k['rid'] = roll_no+" - "+course_code + # Name ID Confusion here , be carefull + courseobj2 = Courses.objects.all().filter(code=course_code) + # if(str(z.student_id) == str(idd)): + for p in courseobj2: + k['course_id'] = course_code + k['course_name'] = course_name + k['sem'] = curr_sem_id.semester_no + k['credits'] = p.credit + k['eletive_id'] = eletive_id + details.append(k) + + year = demo_date.year + month = demo_date.month + yearr = str(year) + "-" + str(year+1) + semflag = 0 + if(month >= 7): + semflag = 1 + else: + semflag = 2 + # TO DO Bdes + date = {'year': yearr, 'semflag': semflag} + course_list = Courses.objects.all() + semester_list = Semester.objects.all() + html = render_to_string('academic_procedures/studentSwayam.html', + {'details': details, + 'dict2': dict2, + 'course_list': course_list, + 'current_sem_swayam':current_sem_swayam, + 'roll_no':roll_no, + 'semester_list': semester_list, + # 'csrf_token' : csrf_token, + 'date': date}, request) + + maindict = {'html': html} + obj = json.dumps(maindict) + return HttpResponse(obj, content_type='application/json') + +def get_currently_registered_elective(student_id, semester_id): + registrations = course_registration.objects.filter(student_id=student_id, semester_id=semester_id) + courses = [] + for registration in registrations: + if registration.course_slot_id.type == "Optional Elective": + courses.append((registration.course_slot_id, registration.course_id, registration.id)) + return courses + + + +def swayam_replace(request): + if request.method == 'POST': + csrf_token = request.POST.get('csrfmiddlewaretoken', None) + + # print(f"---------------------------------{csrf_token}") + try: + + # print(f"djfhajjfsjfhajfhjdsfsdfj{request.POST}") + csrf_token = request.POST.get('csrfmiddlewaretoken', None) + + # print(f"---------------------------------{csrf_token}") + # Accessing individual values by key + user_value = request.POST['user'] + course_id_value = request.POST['course_id'] + + # print(user_value) 20BCS074 + # print(course_id_value) 8955 + + elective_to_delete = course_registration.objects.get(id=course_id_value) + sem = elective_to_delete.semester_id + # print(elective_to_delete) + # print(sem) cse ug curri v1 + + + swayam_course_id_value = request.POST['swayam_course_id'] + swayam_course_id_value_array = [int(id_str) for id_str in swayam_course_id_value.split(',')[:-1]] + # print(swayam_course_id_value_array) + # print(swayam_course_id_value) + + + + swayam_course_slot_id_value = request.POST['swayam_course_slot_id'] + swayam_course_slot_id_value_array = [int(slot_str) for slot_str in swayam_course_slot_id_value.split(',')[:-1]] + # print(swayam_course_slot_id_value_array) + # print(swayam_course_slot_id_value) + + + swayam_semester_id_value = request.POST['swayam_semester_id'] + swayam_semester_id_value_array = [int(semester_str) for semester_str in swayam_semester_id_value.split(',')[:-1]] + # print(swayam_semester_id_value_array) + # print(swayam_semester_id_value) + + # from your_app.models import Student + # Retrieve the Student object based on the student ID + # student_id = '20BCS074' + # student_model = Student.objects.get(id=user_value) + #print(student) + # course_id_model = Course.objects.get() + # Create the course_registration object with the Student object + # course_registration.objects.create(student_id=student, ...) + + + + + n = len(swayam_course_id_value_array) + # print(n) + # new_row_data = [] + for i in range(n): + course_id_model = Courses.objects.get(id=swayam_course_id_value_array[i]) + # print(course_id_model) + semester_id_model = Semester.objects.get(id=swayam_semester_id_value_array[i]) + student_id_model = Student.objects.get(id=user_value) + course_slot_id_model = CourseSlot.objects.get(id=swayam_course_slot_id_value_array[i]) + obj = course_registration( + course_id = course_id_model, + semester_id = semester_id_model, + student_id = student_id_model, + course_slot_id = course_slot_id_model, + working_year = 1 + ) + obj.save() + + # for j in range(n): + # SwayamCourses.objects.filter(course_id = swayam_course_id_value_array[j], student_id=user_value).update(course_used = True) + + elective_to_delete.delete() + + + messages.success(request, "Your Courses have been replaced.") + return HttpResponseRedirect('/academic-procedures/main') + + + + + except Exception as e: + error_message = str(e) + print("Error:", error_message) + messages.error(request, f"Error in Registration: {error_message}") + return HttpResponseRedirect('/academic-procedures/main') + else: + return HttpResponseRedirect('/academic-procedures/main') \ No newline at end of file diff --git a/FusionIIIT/applications/complaint_system/admin.py b/FusionIIIT/applications/complaint_system/admin.py index 84314fcd9..8bf43cab7 100644 --- a/FusionIIIT/applications/complaint_system/admin.py +++ b/FusionIIIT/applications/complaint_system/admin.py @@ -1,8 +1,9 @@ from django.contrib import admin -from .models import Caretaker, StudentComplain, Supervisor, Workers +from .models import Caretaker, StudentComplain, Supervisor, Workers, SectionIncharge admin.site.register(Caretaker) admin.site.register(Workers) admin.site.register(StudentComplain) admin.site.register(Supervisor) +admin.site.register(SectionIncharge) diff --git a/FusionIIIT/applications/complaint_system/api/views.py b/FusionIIIT/applications/complaint_system/api/views.py index 612c6573c..304697017 100644 --- a/FusionIIIT/applications/complaint_system/api/views.py +++ b/FusionIIIT/applications/complaint_system/api/views.py @@ -23,7 +23,7 @@ def complaint_details_api(request,detailcomp_id1): if complaint_detail.worker_id is None: worker_detail_serialized = {} else : - worker_detail = worker_detail.objects.get(id=complaint_detail.worker_id) + worker_detail = Workers.objects.get(id=complaint_detail.worker_id.id) worker_detail_serialized = serializers.WorkersSerializers(instance=worker_detail).data complainer = User.objects.get(username=complaint_detail.complainer.user.username) complainer_serialized = serializers.UserSerializers(instance=complainer).data @@ -154,7 +154,7 @@ def caretaker_api(request): user = get_object_or_404(User ,username=request.user.username) user = ExtraInfo.objects.all().filter(user = user).first() try : - supervisor = Supervisor.objects.get(staff_id=user) + supervisor = Supervisor.objects.get(sup_id=user) except Supervisor.DoesNotExist: return Response({'message':'Logged in user does not have the permissions'},status=status.HTTP_203_NON_AUTHORITATIVE_INFORMATION) serializer = serializers.CaretakerSerializers(data=request.data) @@ -170,7 +170,7 @@ def edit_caretaker_api(request,c_id): user = get_object_or_404(User ,username=request.user.username) user = ExtraInfo.objects.all().filter(user = user).first() try : - supervisor = Supervisor.objects.get(staff_id=user) + supervisor = Supervisor.objects.get(sup_id=user) except Supervisor.DoesNotExist: return Response({'message':'Logged in user does not have the permissions'},status=status.HTTP_203_NON_AUTHORITATIVE_INFORMATION) try: diff --git a/FusionIIIT/applications/complaint_system/models.py b/FusionIIIT/applications/complaint_system/models.py index 9f8849e69..47145fad3 100644 --- a/FusionIIIT/applications/complaint_system/models.py +++ b/FusionIIIT/applications/complaint_system/models.py @@ -12,11 +12,13 @@ class Constants: ('hall-1', 'hall-1'), ('hall-3', 'hall-3'), ('hall-4', 'hall-4'), - ('CC1', 'CC1'), - ('CC2', 'CC2'), + ('library', 'CC1'), + ('computer center', 'CC2'), ('core_lab', 'core_lab'), ('LHTC', 'LHTC'), ('NR2', 'NR2'), + ('NR3', 'NR3'), + ('Admin building', 'Admin building'), ('Rewa_Residency', 'Rewa_Residency'), ('Maa Saraswati Hostel', 'Maa Saraswati Hostel'), ('Nagarjun Hostel', 'Nagarjun Hostel'), @@ -42,11 +44,18 @@ class Caretaker(models.Model): # no_of_comps = models.CharField(max_length=1000) def __str__(self): - return str(self.id) + '-' + self.area + return str(self.id) + '-' + str(self.area) +class SectionIncharge(models.Model): + staff_id = models.ForeignKey(ExtraInfo, on_delete=models.CASCADE) + work_type = models.CharField(choices=Constants.COMPLAINT_TYPE, + max_length=20, default='Electricity') + + def __str__(self): + return str(self.id) + '-' + self.work_type class Workers(models.Model): - caretaker_id = models.ForeignKey(Caretaker, on_delete=models.CASCADE) + secincharge_id = models.ForeignKey(SectionIncharge, on_delete=models.CASCADE, null=True) name = models.CharField(max_length=50) age = models.CharField(max_length=10) phone = models.BigIntegerField(blank=True) @@ -82,7 +91,7 @@ def __str__(self): class Supervisor(models.Model): sup_id = models.ForeignKey(ExtraInfo, on_delete=models.CASCADE) - area = models.CharField(choices=Constants.AREA, max_length=20) + type = models.CharField(choices=Constants.COMPLAINT_TYPE, max_length=30,default='Electricity') def __str__(self): - return str(self.sup_id.user.username) + return str(self.sup_id) + '-' + str(self.type) diff --git a/FusionIIIT/applications/complaint_system/static/complaint_system/js/rating.js b/FusionIIIT/applications/complaint_system/static/complaint_system/js/rating.js index 3884f885b..825fe759d 100644 --- a/FusionIIIT/applications/complaint_system/static/complaint_system/js/rating.js +++ b/FusionIIIT/applications/complaint_system/static/complaint_system/js/rating.js @@ -58,6 +58,93 @@ $(document).ready(function(){ } }; + function sub2(event) + { + var specific_location= $('input[name="specific_location"]').val(); + var Location = $('input[name="Location"]').val(); + var complaint_type = $('input[name="complaint_type"]').val() ; + var details =$('input[name="details"]').val() ; + var myfile = $('input[name="myfile"]').val(); + if(specific_location=="" || Location=="" || details=="" || complaint_type=="") + { + alert("Please fill all the details!"); + return; + } + else + { + event.preventDefault(); + $.ajax({ + type : 'POST', + url : '.', + data : { + 'specific_location' : specific_location, + 'Location' : Location, + 'complaint_type' : complaint_type, + 'details' : details, + 'myfile' : myfile, + + }, + success : function (data){ + + // alert("Complaint successfully lodged"); + setTimeout(function() { + window.location.replace('http://localhost:8000/complaint/caretaker'); + }, 1500); + + + }, + error : function (data,err){ + alert('Complaint successfully lodged ... '); + + } + }); + } + }; + function sub3(event) + { + var specific_location= $('input[name="specific_location"]').val(); + var Location = $('input[name="Location"]').val(); + var complaint_type = $('input[name="complaint_type"]').val() ; + var details =$('input[name="details"]').val() ; + var myfile = $('input[name="myfile"]').val(); + if(specific_location=="" || Location=="" || details=="" || complaint_type=="") + { + alert("Please fill all the details!"); + return; + } + else + { + event.preventDefault(); + $.ajax({ + type : 'POST', + url : '.', + data : { + 'specific_location' : specific_location, + 'Location' : Location, + 'complaint_type' : complaint_type, + 'details' : details, + 'myfile' : myfile, + + }, + success : function (data){ + + // alert("Complaint successfully lodged"); + setTimeout(function() { + window.location.replace('http://localhost:8000/complaint/supervisor'); + }, 1500); + + + }, + error : function (data,err){ + alert('Complaint successfully lodged ... '); + + } + }); + } + }; + + + @@ -767,3 +854,98 @@ $.fn.rating.settings = { }; })( jQuery, window, document ); + + +function paginate(tableId, rowsPerPage, paginationDiv) { + var currentPage = 1; + var tableRows = document.querySelectorAll('#' + tableId + ' tbody tr'); + var totalPages = Math.ceil(tableRows.length / rowsPerPage); + + function displayRows() { + var startIndex = (currentPage - 1) * rowsPerPage; + var endIndex = startIndex + rowsPerPage; + tableRows.forEach(function (row, index) { + if (index >= startIndex && index < endIndex) { + row.style.display = ''; + } else { + row.style.display = 'none'; + } + }); + } + + function generatePagination() { + var pagination = document.getElementById(paginationDiv); + pagination.innerHTML = ''; + + var maxPagesToShow = 5; + + // Calculate the range of pages to display + var startPage = Math.max(1, currentPage - Math.floor(maxPagesToShow / 2)); + var endPage = Math.min(totalPages, startPage + maxPagesToShow - 1); + + // Adjust startPage and endPage if needed + if (endPage - startPage < maxPagesToShow - 1) { + startPage = Math.max(1, endPage - maxPagesToShow + 1); + } + + // Create the backward scroll button + if (currentPage > 1) { + pagination.appendChild(createScrollButton('<')); + } + + // Create the page links + for (var i = startPage; i <= endPage; i++) { + pagination.appendChild(createPageLink(i)); + } + + // Create the forward scroll button + if (currentPage < totalPages) { + pagination.appendChild(createScrollButton('>')); + } +} + +function createScrollButton(label) { + var button = document.createElement('button'); + button.textContent = label; + button.addEventListener('click', function () { + if (label === '<') { + currentPage = Math.max(1, currentPage - 1); + } else { + currentPage = Math.min(totalPages, currentPage + 1); + } + displayRows(); + generatePagination(); + }); + return button; +} + + + function createPageLink(pageNumber) { + var link = document.createElement('a'); + link.href = '#'; + link.textContent = pageNumber; + link.style.display = 'inline-block'; + link.style.padding = '5px 10px'; + link.style.marginRight = '5px'; + link.style.color = '#333'; + link.style.textDecoration = 'none'; + link.style.border = '1px solid #ccc'; + link.style.borderRadius = '3px'; + + if (pageNumber === currentPage) { + link.style.backgroundColor = '#007bff'; + link.style.color = '#fff'; + } + + link.addEventListener('click', function () { + currentPage = parseInt(this.textContent); + displayRows(); + generatePagination(); + }); + + return link; + } + + displayRows(); + generatePagination(); +} \ No newline at end of file diff --git a/FusionIIIT/applications/complaint_system/urls.py b/FusionIIIT/applications/complaint_system/urls.py index b95605ade..2bd0c87e0 100644 --- a/FusionIIIT/applications/complaint_system/urls.py +++ b/FusionIIIT/applications/complaint_system/urls.py @@ -9,33 +9,30 @@ url(r'^$', views.check, name='complaint'), # url(r'^login/$', views.login1, name='complaint'), url(r'^user/$', views.user), - url(r'^user/caretakerfb/$' , views.caretaker_feedback), - url(r'^user/(?P[0-9]+)/$', views.submitfeedback), url(r'^user/detail/(?P[0-9]+)/$', views.detail,name='detail'), - # url(r'^user/check_complaint/$', views.save_comp), - + # url(r'^user/check_complaint/$', views.save_comp), # caretaker + url(r'^caretaker/lodge/$', views.caretakerlodge), url(r'^caretaker/$', views.caretaker, name='caretaker'), url(r'^caretaker/feedback/(?P[0-9]+)/$', views.feedback_care), - url(r'^caretaker/worker_id_know_more/(?P[0-9]+)/complaint_reassign/(?P[0-9]+)/discharge_worker/$', views.discharge_worker,name='discharge_worker'), - url(r'^caretaker/worker_id_know_more/(?P[0-9]+)/$', views.worker_id_know_more, name='come_back_to_this'), - url(r'^caretaker/worker_id_know_more/(?P[0-9]+)/complaint_reassign/(?P[0-9]+)/$', views.complaint_reassign), - #url(r'^caretaker/list_caretakers_area/$', views.caretaker, name='caretaker'), url(r'^caretaker/pending/(?P[0-9]+)/$', views.resolvepending), - url(r'^caretaker/detail2/(?P[0-9]+)/$', views.detail2,name='detail2'), + url(r'^caretaker/detail2/(?P[0-9]+)/$', views.detail), url(r'^caretaker/search_complaint$', views.search_complaint), + url(r'^caretaker/(?P[0-9]+)/feedback/$', views.submitfeedbackcaretaker), # supervisor + url(r'^supervisor/lodge/$', views.supervisorlodge), url(r'^supervisor/$', views.supervisor), url(r'^supervisor/feedback/(?P[0-9]+)/$', views.feedback_super), url(r'^supervisor/caretaker_id_know_more/(?P[0-9]+)/$', views.caretaker_id_know_more), - url(r'^supervisor/caretaker_id_know_more/(?P[0-9]+)/complaint_reassign_super/(?P[0-9]+)/$', views.complaint_reassign_super, name = 'complaint_reassign_super'), - url(r'^supervisor/detail3/(?P[0-9]+)/$', views.detail3, name = 'detail3'), - + # url(r'^supervisor/caretaker_id_know_more/(?P[0-9]+)/complaint_reassign_super/(?P[0-9]+)/$', views.complaint_reassign_super, name = 'complaint_reassign_super'), + url(r'^supervisor/detail/(?P[0-9]+)/$', views.detail3, name = 'detail3'), + url(r'^supervisor/pending/(?P[0-9]+)/$', views.resolvependingsuper), + url(r'^supervisor/(?P[0-9]+)/$', views.submitfeedbacksuper), @@ -45,6 +42,7 @@ url(r'^caretaker/deletecomplaint/(?P[0-9]+)/$', views.deletecomplaint), # url(r'^caretaker/(?P[0-9]+)/$', views.assign_worker), url(r'^caretaker/(?P[0-9]+)/(?P[0-9]+)/$', views.changestatus), + url(r'^supervisor/(?P[0-9]+)/(?P[0-9]+)/$', views.changestatussuper), url(r'^api/',include('applications.complaint_system.api.urls')) diff --git a/FusionIIIT/applications/complaint_system/views.py b/FusionIIIT/applications/complaint_system/views.py index b566856aa..9d3dd7316 100644 --- a/FusionIIIT/applications/complaint_system/views.py +++ b/FusionIIIT/applications/complaint_system/views.py @@ -10,96 +10,85 @@ from applications.globals.models import User , ExtraInfo, HoldsDesignation from notifications.models import Notification -from .models import Caretaker, StudentComplain, Supervisor, Workers +from .models import Caretaker, StudentComplain, Supervisor, Workers, SectionIncharge from notification.views import complaint_system_notif -#function for reassign to another worker -@login_required -def complaint_reassign(request,wid,iid): - current_user = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() - if request.method == 'POST': - type = request.POST.get('submit', '') - a = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - comp_id = y.id - if type == 'assign': - - complaint_finish = request.POST.get('complaint_finish', '') - worker_id = request.POST.get('assign_worker', '') - w = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=worker_id) - StudentComplain.objects.select_for_update().filter(id=iid).\ - update(worker_id=w, status=1) - url = '/complaint/caretaker/worker_id_know_more/'+wid; - complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=iid) - student=0 - message = "Your complaint has been re-assigned" - complaint_system_notif(request.user, complainer_details.complainer.user ,'reassign_worker_alert',complainer_details.id,student,message) - return HttpResponseRedirect(url) - elif type == 'redirect': - assign_caretaker = request.POST.get('assign_caretaker', '') - c = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(id=assign_caretaker) - c1 = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(id=iid) - remark = 'Redirect complaint from ' + c1.area - StudentComplain.objects.select_for_update().filter(id=iid).\ - update(location=c.area, remarks=remark) - url = '/complaint/caretaker/worker_id_know_more/'+wid; - complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=iid) - student=0 - message = "Your complaint has been redirected to another caretaker" - complaint_system_notif(request.user, complainer_details.complainer.user ,'comp_redirect_alert',complainer_details.id,student,message) - return HttpResponseRedirect(url) - - else: - y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) - a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) - b = a.area - comp_id = y.id - try: - detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=iid).first() - total_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').all() - total_caretakers_in_area = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=b) - worker = [] - workertemp = [] - flag = '' - temp = detail.location - try: - - if Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a).count() == 0: - flag = 'no_worker' - else: - workertemp = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a) - j = 1 - for i in workertemp: - worker.append(i) - # if j%2 != 0: - # worker.append(i) - # j = j + 1 - - - except Caretaker.DoesNotExist: - flag = 'no_worker' - - except StudentComplain.DoesNotExist: - return HttpResponse("

Not a valid complaint

") - return render(request, "complaintModule/reassignworker.html", - {'detail': detail, 'worker': worker, 'flag': - flag, 'total_caretaker': total_caretaker,'a':a, 'wid':wid, 'total_caretakers_in_area':total_caretakers_in_area}) - -@login_required -def complaint_reassign_super(request,caretaker_id,iid): - current_user = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() - sup = Supervisor.objects.select_related('sup_id','sup_id__user','sup_id__department').get(sup_id = y) - this_area = sup.area - if request.method == 'POST': - a = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - comp_id = y.id - - +from applications.filetracking.sdk.methods import * +from applications.filetracking.models import * +from operator import attrgetter +#function for reassign to another worker +# @login_required +# def complaint_reassign(request,wid,iid): + # current_user = get_object_or_404(User, username=request.user.username) + # y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() + # if request.method == 'POST': + # type = request.POST.get('submit', '') + # a = get_object_or_404(User, username=request.user.username) + # y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() + # comp_id = y.id + # if type == 'assign': + + # complaint_finish = request.POST.get('complaint_finish', '') + # worker_id = request.POST.get('assign_worker', '') + # w = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=worker_id) + # StudentComplain.objects.select_for_update().filter(id=iid).\ + # update(worker_id=w, status=1) + # url = '/complaint/secincharge/worker_id_know_more/'+wid; + # complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=iid) + # student=0 + # message = "Your complaint has been re-assigned" + # complaint_system_notif(request.user, complainer_details.complainer.user ,'reassign_worker_alert',complainer_details.id,student,message) + # return HttpResponseRedirect(url) + + # else: + # y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) + # a = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) + # b = a.work_type + # comp_id = y.id + # try: + # detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=iid).first() + # total_secincharge = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').all() + # total_secincharges_in_area = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(work_type=b) + # worker = [] + # workertemp = [] + # flag = '' + # temp = detail.location + # try: + + # if Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a).count() == 0: + # flag = 'no_worker' + # else: + # workertemp = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a) + # j = 1 + # for i in workertemp: + # worker.append(i) + + # except SectionIncharge.DoesNotExist: + # flag = 'no_worker' + + # except StudentComplain.DoesNotExist: + # return HttpResponse("

Not a valid complaint

") + # return render(request, "complaintModule/reassignworker.html", + # {'detail': detail, 'worker': worker, 'flag': + # flag, 'total_secincharge': total_secincharge,'a':a, 'wid':wid, 'total_secincharges_in_area':total_secincharges_in_area}) + + + +# @login_required +# def complaint_reassign_super(request,caretaker_id,iid): + # current_user = get_object_or_404(User, username=request.user.username) + # y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() + # sup = Supervisor.objects.select_related('sup_id','sup_id__user','sup_id__department').get(sup_id = y) + # this_area = sup.area + # if request.method == 'POST': + # a = get_object_or_404(User, username=request.user.username) + # y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() + # comp_id = y.id + + +#for SectionIncharge @login_required def assign_worker(request, comp_id1): current_user = get_object_or_404(User, username=request.user.username) @@ -121,88 +110,89 @@ def assign_worker(request, comp_id1): a = get_object_or_404(User, username=request.user.username) y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() comp_id = y.id - if type == 'assign': - complaint_finish = request.POST.get('complaint_finish', '') - worker_id = request.POST.get('assign_worker', '') - w = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=worker_id) - StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').select_for_update().filter(id=comp_id1).\ - update(worker_id=w, status=1) - complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=comp_id1) - student = 0 - message = "Worker has been assigned to your complaint" - complaint_system_notif(request.user, complainer_details.complainer.user ,'assign_worker_alert',complainer_details.id,student,message) - - return HttpResponseRedirect('/complaint/caretaker/') - elif type == 'redirect': - assign_caretaker = request.POST.get('assign_caretaker', '') - c = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(id=assign_caretaker) - c1 = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(id=comp_id) - remark = 'Redirect complaint from ' + c1.area - StudentComplain.objects.select_for_update().filter(id=comp_id1).\ - update(location=c.area, remarks=remark) - complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=comp_id1) - student=0 - message = "Your Complaint has been redirected to another caretaker" - complaint_system_notif(request.user, complainer_details.complainer.user ,'comp_redirect_alert',complainer_details.id,student,message) - return HttpResponseRedirect('/complaint/caretaker/') + + + complaint_details = StudentComplain.objects.all().filter(id=comp_id1) + + + + complaint_type=complaint_details[0].complaint_type + + supervisor=Supervisor.objects.all().filter(type=complaint_type) + if not supervisor.exists(): + return HttpResponse("

Supervisor does not exist of this complaint type

") + + supervisor_details=ExtraInfo.objects.all().filter(id=supervisor[0].sup_id.id) + + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=comp_id1).\ + update(status=1) + + sup = HoldsDesignation.objects.select_related('user','working','designation').filter(user = supervisor_details[0].user_id) + + + files=File.objects.all().filter(src_object_id=comp_id1) + + supervisor_username=User.objects.all().filter(id=supervisor_details[0].user_id) + file=forward_file(file_id= files.first().id, + receiver=supervisor_username[0].username, + receiver_designation=sup[0].designation, + file_extra_JSON= {}, + remarks = "", + file_attachment= None) + print(file) + + + return HttpResponseRedirect('/complaint/caretaker/') else: y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) - a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) - b = a.area + # a = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) + comp_id = y.id try: - detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=comp_id1).first() - total_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').all() - total_caretakers_in_area = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=b and id!=a.id) - workertemp = [] - worker = [] - flag = '' - temp = detail.location - try: - #care = Caretaker.objects.filter(area=temp).first() - if Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a).count() == 0: - flag = 'no_worker' - else: - workertemp1 = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a) - workertemp = workertemp1.filter(worker_type=detail.complaint_type) - j = 1 - for i in workertemp: - worker.append(i) - # if j%2 != 0: - # worker.append(i) - # j = j + 1 - - - except Caretaker.DoesNotExist: - flag = 'no_worker' + detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=comp_id1).first() + # total_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').all() + # total_caretakers_in_area = Supervisor.objects.select_related('sup_id') + # supervisors_in_area= HoldsDesignation.objects.select_related('user','working','designation').get(total_caretakers_in_area = dsgn) + # workertemp = [] + # worker = [] + # flag = '' + # temp = detail.location + # try: + # if Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a).count() == 0: + # flag = 'no_worker' + # else: + # workertemp1 = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a) + # workertemp = workertemp1.filter(worker_type=detail.complaint_type) + # j = 1 + # for i in workertemp: + # worker.append(i) + + # except SectionIncharge.DoesNotExist: + # flag = 'no_worker' except StudentComplain.DoesNotExist: return HttpResponse("

Not a valid complaint

") return render(request, "complaintModule/assignworker.html", - {'detail': detail, 'worker': worker, 'flag': - flag, 'total_caretaker': total_caretaker,'a':a, 'total_caretakers_in_area':total_caretakers_in_area}) + {'detail': detail}) + +#for SectionIncharge @login_required def discharge_worker(request,wid,cid): current_user = get_object_or_404(User, username=request.user.username) y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() - this_worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=wid) - com_in_concern= StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=cid); + this_worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=wid) + com_in_concern= StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=cid); com_in_concern.worker_id=None; com_in_concern.status=0; StudentComplain.objects.select_for_update().filter(id=cid).\ update(worker_id=None, status=0) - #StudentComplain.objects.get(id=cid).delete() - url='/complaint/caretaker/detail2/'+cid; + url='/complaint/secincharge/detail2/'+cid; return HttpResponseRedirect(url) - - - - @login_required def caretaker_feedback(request): """ @@ -234,23 +224,23 @@ def caretaker_feedback(request): return render(request, "complaintModule/submit_feedback_caretaker.html", {'a': a}) +#for SectionIncharge @login_required def worker_id_know_more(request, work_id): """ function to know pending complaints assigned to the worker """ - this_worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=work_id) - num = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(worker_id=this_worker).count(); - complaints_list = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(worker_id=this_worker); + this_worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=work_id) + num = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(worker_id=this_worker).count(); + complaints_list = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(worker_id=this_worker); complaints_list_onhold = [] for i in complaints_list: if i.status == 1: complaints_list_onhold.append(i) numpend = len(complaints_list_onhold) - work_under_caretaker1 = this_worker.caretaker_id.staff_id.user.first_name - work_under_caretaker2 = this_worker.caretaker_id.staff_id.user.last_name - return render(request, "complaintModule/worker_id_know_more.html",{'this_worker':this_worker,'work_under_caretaker1':work_under_caretaker1,'work_under_caretaker2':work_under_caretaker2, 'num':num, 'complaints_list':complaints_list, 'complaints_list_onhold':complaints_list_onhold, 'numpend':numpend}) - + work_under_secincharge1 = this_worker.secincharge_id.staff_id.user.first_name + work_under_secincharge2 = this_worker.secincharge_id.staff_id.user.last_name + return render(request, "complaintModule/worker_id_know_more.html",{'this_worker':this_worker,'work_under_secincharge1':work_under_secincharge1,'work_under_secincharge2':work_under_secincharge2, 'num':num, 'complaints_list':complaints_list, 'complaints_list_onhold':complaints_list_onhold, 'numpend':numpend}) @@ -283,12 +273,31 @@ def check(request): print('----------------------------') print('----------------------------') print('----------------------------') - if b.user_type == 'student': + supervisor_list=Supervisor.objects.all() + caretaker_list=Caretaker.objects.all() + is_supervisor=False + is_caretaker=False + for i in supervisor_list: + if b.id==i.sup_id_id: + is_supervisor=True + break + for i in caretaker_list: + if b.id==i.staff_id_id: + is_caretaker=True + break + if is_supervisor: + return HttpResponseRedirect('/complaint/supervisor/') + elif is_caretaker: + return HttpResponseRedirect('/complaint/caretaker/') + + elif b.user_type == 'student': return HttpResponseRedirect('/complaint/user/') + # elif b.user_type == 'fx': + # return HttpResponseRedirect('/complaint/supervisor/') elif b.user_type == 'staff': - return HttpResponseRedirect('/complaint/caretaker/') + return HttpResponseRedirect('/complaint/user/') elif b.user_type == 'faculty': - return HttpResponseRedirect('/complaint/supervisor/') + return HttpResponseRedirect('/complaint/user/') else: return HttpResponse("

wrong user credentials

") else: @@ -338,20 +347,11 @@ def user(request): complaint_finish = datetime.now() + timedelta(days=4) elif comp_type == 'other': complaint_finish = datetime.now() + timedelta(days=3) - y = ExtraInfo.objects.all().select_related('user','department').get(id=comp_id) - #check if location given + if location!="": - # x = StudentComplain(complainer=y, - # complaint_type=comp_type, - # location=location, - # specific_location=specific_location, - # details=details, - # status=status, - # complaint_finish=complaint_finish, - # upload_complaint=comp_file) - - - # x.save() + + user_details=User.objects.get(id=y.user_id) + obj1, created = StudentComplain.objects.get_or_create(complainer=y, complaint_type=comp_type, location=location, @@ -361,27 +361,11 @@ def user(request): complaint_finish=complaint_finish, upload_complaint=comp_file) - - historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).order_by('-id') - history = [] - j = 1 - k = 1 - for i in historytemp: - history.append(i) - # if j%2 != 0: - # history.append(i) - # j = j+1 - - for h in history: - h.serial_no = k - k = k+1 - # if location == "hall1": - # dsgn = "hall1caretaker" - # elif location == "hall3": - # dsgn = "hall3caretaker" - # else : - # dsgn = "hall4caretaker" + + + + if location == "hall-1": dsgn ="hall1caretaker" elif location =="hall-3": @@ -408,24 +392,38 @@ def user(request): dsgn = "rewacaretaker" caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = dsgn) + c1=HoldsDesignation.objects.filter(user_id=y.user_id).all() + print(c1[0].designation) + file_id = create_file(uploader=user_details.username, + uploader_designation=c1[0].designation, + receiver=caretaker_name.user.username, + receiver_designation=caretaker_name.designation, + src_module="complaint", + src_object_id= str(obj1.id), + file_extra_JSON= {}, + attached_file = None) + + # print(" wertyuioiuhygfdsdfghjk") + print(file_id) # This is to allow the student - student = 1 + student = 0 message = "A New Complaint has been lodged" complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert',obj1.id,student,message) - - # return render(request, "complaintModule/complaint_user.html", - # {'history': history, 'comp_id': comp_id }) - # next = request.POST.get('next', '/') + # complaint_system_notif(request.user, secincharge_name.staff_id.user,'lodge_comp_alert',obj1.id,1,message) messages.success(request,message) + + + return HttpResponseRedirect('/complaint/user') else: a = get_object_or_404(User, username=request.user.username) y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).order_by('-id') - history=[] + + user_details=User.objects.get(id=y.user_id) + notification = Notification.objects.filter(recipient=a.id) notification = notification.filter(data__exact={'url':'complaint:detail','module':'Complaint System'}) @@ -437,45 +435,54 @@ def user(request): # notification_message.append(notification.verb+' by '+ to + ' ' + duration + ' ago ') + c1=HoldsDesignation.objects.filter(user_id=y.user_id).all() + print(c1[0].designation) + # c2=Designation.objects.filter(i) - - j = 1 - for i in historytemp: - history.append(i) - # if j%2 != 0: - # history.append(i) - # j = j+1 - - for i in history: - i.serial_no = j - j = j+1 - - # if location == "hall-1": - # dsgn ="hall1caretaker" - # elif location =="hall-3": - # dsgn ="hall3caretaker" - # elif location =="hall-4": - # dsgn ="hall4caretaker" - # elif location =="CC1": - # dsgn ="CC convenor" - # elif location =="CC2": - # dsgn ="CC2 convener" - # elif location == "core_lab": - # dsgn = "corelabcaretaker" - # elif location =="LHTC": - # dsgn ="lhtccaretaker" - # elif location =="NR2": - # dsgn ="nr2caretaker" - # else: - # dsgn = "rewacaretaker" - # caretaker_name = HoldsDesignation.objects.get(designation__name = dsgn) + + - # complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert') + outbox_files = view_outbox( + username=user_details.username, + designation=c1[0].designation, + src_module="complaint" + ) + print(outbox_files) + + outbox=[] + comp_list=set() + for i in outbox_files: + + outbox.append(i) + print(outbox) + for i in outbox: + file_history = view_history(file_id=i['id']) + print(i['id']) + comp=File.objects.filter(id=i['id']) + print(comp[0].src_object_id) + complaint=StudentComplain.objects.all().filter(id=comp[0].src_object_id) + print(complaint) + if complaint[0].complainer.user.username == user_details.username : + comp_list.add(complaint) + # file_history = view_history(file_id=i['id']) + + # comp=File.objects.filter(uploader=file_history[0]['current_id']) + # for j in comp: + # c=StudentComplain.objects.all().filter(id=j.src_object_id) + # comp_list.add(c) + # print(c[0]) + + # break + complaint_final_list=[] + for i in comp_list: + complaint_final_list.append(i[0]) + + sorted_history = sorted(complaint_final_list, key=attrgetter('complaint_date'), reverse=True) + print(complaint_final_list) return render(request, "complaintModule/complaint_user.html", - {'history': history,'notification':notification, 'comp_id': y.id}) + {'outbox': sorted_history,'notification':notification, 'comp_id': y.id, 'history':outbox}) + - return render(request, "complaintModule/complaint_user.html", - {'history': history, 'comp_id': comp_id }) @login_required def save_comp(request): """ @@ -523,14 +530,15 @@ def save_comp(request): upload_complaint =comp_file) x.save() - # messages.info(request,'Complaint successfully launched.') - # return HttpResponseRedirect('/complaint/user/') + return HttpResponseRedirect('/complaint/user/') + + @login_required def caretaker(request): """ - The function is used to display details to the caretaker such as registered complaints and allows to assign workers + The function is used to display details to the caretaker such as registered complaints @param: request - trivial. @@ -543,21 +551,21 @@ def caretaker(request): """ current_user = get_object_or_404(User, username=request.user.username) y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() - + if request.method == 'POST': - type = request.POST.get('submit', '') - worker_type = request.POST.get('complaint_type', '') - name = request.POST.get('name', '') - phone = request.POST.get('phone_no', '') - age = request.POST.get('age', '') - try: - y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) - a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) - except Exception as e: - a = None - y = None - intage = int(age) - intphone = int(phone) + # type = request.POST.get('submit', '') + # worker_type = request.POST.get('complaint_type', '') + # name = request.POST.get('name', '') + # phone = request.POST.get('phone_no', '') + # age = request.POST.get('age', '') + # try: + # y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) + # a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) + # except Exception as e: + # a = None + # y = None + # intage = int(age) + # intphone = int(phone) # if len(phone) == 10 and intage > 20 and intage < 50 and intphone > 1999999999: # x = Workers(caretaker_id=a, # name=name, @@ -567,116 +575,252 @@ def caretaker(request): # if not Workers.objects.filter(caretaker_id=a,name=name, age=age,phone=phone,worker_type=worker_type).exists(): # x.save() - if len(phone) == 10 and intage > 20 and intage < 50 and intphone > 1999999999: - obj, created = Workers.objects.get_or_create(caretaker_id=a, - name=name, - age=age, - phone=phone, - worker_type=worker_type) - - b = a.area - historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location=b).order_by('-id') - history = [] - j = 1 - k = 1 - for i in historytemp: - history.append(i) - # if j%2 == 1: - # history.append(i) - # j = j+1 - for h in history: - h.serial_no = k - k=k+1 + # if len(phone) == 10 and intage > 20 and intage < 50 and intphone > 1999999999: + # obj, created = Workers.objects.get_or_create(caretaker_id=a, + # name=name, + # age=age, + # phone=phone, + # worker_type=worker_type) + # b = a.area + # historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location=b).order_by('-id') + # history = [] + # j = 1 + # k = 1 + # for i in historytemp: + # history.append(i) + # # if j%2 == 1: + # # history.append(i) + # # j = j+1 + + # for h in history: + # h.serial_no = k + # k=k+1 + user_details=User.objects.get(id=y.user_id) + # if user_details.username=="shyams": + # desgn="hall3caretaker" + # if user_details.username=="hall4caretaker": + # desgn="hall4caretaker" + + # total_worker = [] + - total_worker = [] - total_workertemp = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a) - j = 1 + # total_workertemp = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a) + # j = 1 # for i in total_workertemp: # if j%2 != 0: # total_worker.append(i) # j = j + 1 - for i in total_workertemp: - total_worker.append(i) + # for i in total_workertemp: + # total_worker.append(i) complaint_assign_no = [] + comp_type = request.POST.get('complaint_type', '') + location = request.POST.get('Location', '') + specific_location = request.POST.get('specific_location', '') + comp_file = request.FILES.get('myfile') + + details = request.POST.get('details', '') + status = 0 + # finish time is according to complaint type + complaint_finish = datetime.now() + timedelta(days=2) + if comp_type == 'Electricity': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'carpenter': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'plumber': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'garbage': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'dustbin': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'internet': + complaint_finish = datetime.now() + timedelta(days=4) + elif comp_type == 'other': + complaint_finish = datetime.now() + timedelta(days=3) + # y = ExtraInfo.objects.all().select_related('user','department').get(id=comp_id) + #check if location given + if location!="": + user_details=User.objects.get(id=y.user_id) + obj1, created = StudentComplain.objects.get_or_create(complainer=y, + complaint_type=comp_type, + location=location, + specific_location=specific_location, + details=details, + status=status, + complaint_finish=complaint_finish, + upload_complaint=comp_file) + + + if location == "hall-1": + dsgn ="hall1caretaker" + elif location =="hall-3": + dsgn ="hall3caretaker" + elif location =="hall-4": + dsgn ="hall4caretaker" + elif location =="CC1": + dsgn ="cc1convener" + elif location =="CC2": + dsgn ="CC2 convener" + elif location == "core_lab": + dsgn = "corelabcaretaker" + elif location =="LHTC": + dsgn ="lhtccaretaker" + elif location =="NR2": + dsgn ="nr2caretaker" + elif location =="Maa Saraswati Hostel": + dsgn ="mshcaretaker" + elif location =="Nagarjun Hostel": + dsgn ="nhcaretaker" + elif location =="Panini Hostel": + dsgn ="phcaretaker" + else: + dsgn = "rewacaretaker" + caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = dsgn) + print(caretaker_name.user.username) + print(user_details.username) + print(caretaker_name.designation) + + user_details=User.objects.get(id=y.user_id) + des=HoldsDesignation.objects.filter(user=user_details).all() + file_id = create_file(uploader=user_details.username, + uploader_designation=des[0].designation, + receiver=caretaker_name.user.username, + receiver_designation=dsgn, + src_module="complaint", + src_object_id= str(obj1.id), + file_extra_JSON= {}, + attached_file = None) + + + # This is to allow the student + student = 1 + message = "A New Complaint has been lodged" + complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert',obj1.id,student,message) + + # return render(request, "complaintModule/complaint_user.html", + # {'history': history, 'comp_id': comp_id }) + # next = request.POST.get('next', '/') + + messages.success(request,message) + # return HttpResponseRedirect('/complaint/user') + - for x in total_worker: - worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=x.id) - temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(worker_id=worker).count() - worker.total_complaint = temp - complaint_assign_no.append(worker) + # for x in total_worker: + # worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=x.id) + # temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(worker_id=worker).count() + # worker.total_complaint = temp + # complaint_assign_no.append(worker) notification = Notification.objects.filter(recipient=current_user.id) notification = notification.filter(data__exact={'url':'complaint:detail2','module':'Complaint System'}) - return render(request, "complaintModule/complaint_caretaker.html", - {'history': history, 'comp_id': y.id, - 'notification': notification, 'total_worker': - total_worker, 'complaint_assign_no': complaint_assign_no}) + + return HttpResponseRedirect('/complaint/caretaker') else: - y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) - a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) + # y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) + + a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y.id) b = a.area history = [] - historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location=b).order_by('-id') - total_worker = [] - total_workertemp = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a) - j = 1 - for i in total_workertemp: - total_worker.append(i) - - complaint_assign_no = [] + + complaint_assign_no = [] - - for x in total_worker: - worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=x.id) - temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(worker_id=worker).count() - worker.total_complaint = temp - complaint_assign_no.append(worker) - - overduecomplaint = [] - j = 1 - k = 1 - for i in historytemp: - history.append(i) - # if j%2 != 0: - # history.append(i) - # j=j+1 - for i in history: - i.serial_no = k - k = k + 1 - - if i.status != 2 and i.status !=3: - if i.complaint_finish < date.today(): - i.delay = date.today() - i.complaint_finish - overduecomplaint.append(i) + user_details=User.objects.get(id=y.user_id) notification = Notification.objects.filter(recipient=current_user.id) notification = notification.filter(data__exact={'url':'complaint:detail2','module':'Complaint System'}) + user_details=User.objects.get(id=y.user_id) + - + des=HoldsDesignation.objects.filter(user=user_details).all() + print("######") + print(user_details.username) + print(des[0].designation) + print("&&&&&") + outbox_files = view_outbox( + username=user_details.username, + designation=des[0].designation, + src_module="complaint" + ) + + outbox=[] + comp_list=set() + for i in outbox_files: + # print(i) + outbox.append(i) + + for i in outbox: + file_history = view_history(file_id=i['id']) + print(i['id']) + print("********") + comp=File.objects.filter(id=i['id']) + print(comp[0].src_object_id) + print("------") + complaint=StudentComplain.objects.all().filter(id=comp[0].src_object_id) + print(complaint[0].complainer.user.username) + + print("......") + if complaint[0].complainer.user.username== user_details.username : + comp_list.add(complaint) + + # break + complaint_final_list=[] + for i in comp_list: + complaint_final_list.append(i[0]) + sorted_history_out = sorted(complaint_final_list, key=attrgetter('complaint_date'), reverse=True) + + inbox_files = view_inbox( + username=user_details.username, + designation=des[0].designation, + src_module="complaint" + ) + print(inbox_files) + + inbox=[] + comp_list_in=set() + for i in inbox_files: + # print(i) + inbox.append(i) + file_history_list=[] + for i in inbox: + file_history = view_history(file_id=i['id']) + print(i['id']) + comp=File.objects.filter(id=i['id']) + print(comp[0].src_object_id) + complaint=StudentComplain.objects.all().filter(id=comp[0].src_object_id) + print(complaint) + comp_list_in.add(complaint) + + complaint_final_list_in=[] + for i in comp_list_in: + complaint_final_list_in.append(i[0]) + + # print(complaint_final_list_in) + sorted_history = sorted(complaint_final_list_in, key=attrgetter('complaint_date'), reverse=True) + return render(request, "complaintModule/complaint_caretaker.html", - { 'history': history, 'comp_id': y.id, 'total_worker': total_worker, - 'complaint_assign_no': total_worker, - 'notification':notification, - 'overduecomplaint': overduecomplaint, 'care_id': a}) + { 'history': sorted_history, + 'comp_id': y.id, + 'carehistory':sorted_history_out, + 'notification':notification, + 'care_id': a}) @login_required def remove_worker_from_complaint(request,complaint_id): """ - The function is used by caretaker to remove a worker + The function is used by secincharge to remove a worker already assigned to a complaint @param: request - trivial complaint_id - used to get complaint_id registered """ - complaint = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complaint_id=complaint_id).update(worker_id='') + complaint = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(complaint_id=complaint_id).update(worker_id='') return HttpResponseRedirect('/complaint/caretaker/') @@ -698,23 +842,54 @@ def changestatus(request, complaint_id, status): context - Holds data needed to make necessary changes in the template. """ if status == '3': - StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=complaint_id).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=complaint_id).\ update(status=status, worker_id='') return HttpResponseRedirect('/complaint/caretaker/') elif status == '2': - StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=complaint_id).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=complaint_id).\ update(status=status, worker_id='') return HttpResponseRedirect('/complaint/caretaker/') else: - StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=complaint_id).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=complaint_id).\ update(status=status) return HttpResponseRedirect('/complaint/caretaker/') + + +@login_required +def changestatussuper(request, complaint_id, status): + """ + The function is used by caretaker to change the status of a complaint. + @param: + request - trivial. + complaint_id - used to get complaint_id registered. + status-used to get the current status of complaints + + @variables: + issue - The issue object. + supported - True if the user's intention is to support the issue. + support_count - Total supporters of the above issue. + context - Holds data needed to make necessary changes in the template. + """ + if status == '3': + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=complaint_id).\ + update(status=status, worker_id='') + return HttpResponseRedirect('/complaint/supervisor/') + elif status == '2': + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=complaint_id).\ + update(status=status, worker_id='') + return HttpResponseRedirect('/complaint/supervisor/') + else: + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=complaint_id).\ + update(status=status) + return HttpResponseRedirect('/complaint/supervisor/') + + @login_required def removew(request, work_id): """ - The function is used by caretaker to remove workers. + The function is used by secincharge to remove workers. @param: request - trivial. work_id - id of the issue object which the user intends to support/unsupport. @@ -725,15 +900,18 @@ def removew(request, work_id): support_count - Total supporters of the above issue. context - Holds data needed to make necessary changes in the template. """ - worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=work_id) - temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(worker_id=worker).count() + worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=work_id) + temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(worker_id=worker).count() if temp == 0: worker.delete() - return HttpResponseRedirect('/complaint/caretaker/') + return HttpResponseRedirect('/complaint/secincharge/') else: return HttpResponse('

Worker is assign some complaint

') + + + @login_required def submitfeedback(request, complaint_id): """ @@ -752,9 +930,9 @@ def submitfeedback(request, complaint_id): if request.method == 'POST': feedback = request.POST.get('feedback', '') rating = request.POST.get('rating', '') - StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=complaint_id).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=complaint_id).\ update(feedback=feedback, flag=rating) - a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=complaint_id).first() + a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=complaint_id).first() care = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=a.location).first() rate = care.rating newrate = 0 @@ -768,27 +946,26 @@ def submitfeedback(request, complaint_id): Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=a.location).update(rating=newrate) return HttpResponseRedirect('/complaint/user/') - return render(request,"complaintModule/feedback.html",{'a' : a}) else: - a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=complaint_id) + a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=complaint_id) return render(request, "complaintModule/submit_feedback.html", {'a': a}) - - +#for SectionIncharge @login_required def deletecomplaint(request, comp_id1): """ function to delete complaint """ StudentComplain.objects.get(id=comp_id1).delete() - return HttpResponseRedirect('/complaint/caretaker/') + return HttpResponseRedirect('/complaint/secincharge/') + + def testEntry(): - # list1 = [('SKM','hall-1'),('HS','hall-3'),('PS','hall-4'),('MSR','Maa Saraswati Hostel'),('KKB','Maa Saraswati Hostel'), ('RP','Nagarjun Hostel'),('DS','Nagarjun Hostel'),('AV','Panini Hostel')] list1 = [('eecivil','NR2'),('eecivil','Rewa_Residency'),('eecivil','LHTC'),('eecivil','core_lab')] # to delete supervisors @@ -820,9 +997,11 @@ def supervisor(request): """ # print("--------------------------") # testEntry() + # print(request.type) + location = request.POST.get('Location', '') current_user = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() + comp_id = y.id if request.method == 'POST' : try: y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) @@ -830,78 +1009,231 @@ def supervisor(request): except Exception as e: a = None y = None - all_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=a.area).order_by('-id') + all_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=location).order_by('-id') area = all_caretaker[0].area # ExtraInfo.objects.get(id=sup_id) all_complaint = [] - numtemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location = area).filter(status = 0).count() + numtemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(location = area).filter(status = 0).count() num = int(numtemp/2+0.5) - all_complainttemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location=a.area).order_by('-id') - j = 1 - for i in all_complainttemp: - all_complaint.append(i) - # if j%2 != 0: - # all_complaint.append(i) - # j = j + 1 - overduecomplaint = [] - for i in all_complaint: - if i.status != 2 and i.status != 3: - if i.complaint_finish < date.today(): - i.delay = date.today() - i.complaint_finish - overduecomplaint.append(i) + + + + + + + comp_type = request.POST.get('complaint_type', '') + location = request.POST.get('Location', '') + specific_location = request.POST.get('specific_location', '') + comp_file = request.FILES.get('myfile') + + details = request.POST.get('details', '') + status = 0 + # finish time is according to complaint type + complaint_finish = datetime.now() + timedelta(days=2) + if comp_type == 'Electricity': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'carpenter': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'plumber': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'garbage': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'dustbin': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'internet': + complaint_finish = datetime.now() + timedelta(days=4) + elif comp_type == 'other': + complaint_finish = datetime.now() + timedelta(days=3) + y = ExtraInfo.objects.all().select_related('user','department').get(id=comp_id) + #check if location given + if location!="": + # x = StudentComplain(complainer=y, + # complaint_type=comp_type, + # location=location, + # specific_location=specific_location, + # details=details, + # status=status, + # complaint_finish=complaint_finish, + # upload_complaint=comp_file) + + + # x.save() + obj1, created = StudentComplain.objects.get_or_create(complainer=y, + complaint_type=comp_type, + location=location, + specific_location=specific_location, + details=details, + status=status, + complaint_finish=complaint_finish, + upload_complaint=comp_file) + + + + if location == "hall-1": + dsgn ="hall1caretaker" + elif location =="hall-3": + dsgn ="hall3caretaker" + elif location =="hall-4": + dsgn ="hall4caretaker" + elif location =="CC1": + dsgn ="cc1convener" + elif location =="CC2": + dsgn ="CC2 convener" + elif location == "core_lab": + dsgn = "corelabcaretaker" + elif location =="LHTC": + dsgn ="lhtccaretaker" + elif location =="NR2": + dsgn ="nr2caretaker" + elif location =="Maa Saraswati Hostel": + dsgn ="mshcaretaker" + elif location =="Nagarjun Hostel": + dsgn ="nhcaretaker" + elif location =="Panini Hostel": + dsgn ="phcaretaker" + else: + dsgn = "rewacaretaker" + caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = dsgn) + user_details=User.objects.get(id=y.user_id) + # c2=Supervisor.objects.all().filter(area=location) + print(caretaker_name.user.username) + print(user_details.username) + print(caretaker_name.designation) + + # sup = HoldsDesignation.objects.select_related('user','working','designation').get(user = y.id) + # print(sup.designation) + + user_details=User.objects.get(id=y.user_id) + des=HoldsDesignation.objects.filter(user=user_details).all() + + + file_id = create_file(uploader=user_details.username, + uploader_designation=des[0].designation, + receiver=caretaker_name.user.username, + receiver_designation=str(caretaker_name.designation), + src_module="complaint", + src_object_id= str(obj1.id), + file_extra_JSON= {}, + attached_file = None) + + + # This is to allow the student + student = 1 + message = "A New Complaint has been lodged" + complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert',obj1.id,student,message) + + # return render(request, "complaintModule/complaint_user.html", + # {'history': history, 'comp_id': comp_id }) + # next = request.POST.get('next', '/') + + messages.success(request,message) + # return HttpResponseRedirect('/complaint/user') + + return HttpResponseRedirect('/complaint/supervisor') - return render(request, "complaintModule/supervisor1.html", - {'all_caretaker': all_caretaker, 'all_complaint': all_complaint, - 'overduecomplaint': overduecomplaint, 'area': area,'num':num}) else: - print('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') - y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) - try: - a = get_object_or_404(Supervisor, sup_id=y) - except : - return HttpResponseRedirect('/') - - #print(a) - # if(len(a)==0) : - # return render('../dashboard/') - a = Supervisor.objects.select_related('sup_id','sup_id__user','sup_id__department').get(sup_id=y) - all_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=a.area).order_by('-id') + + + all_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').order_by('-id') area = all_caretaker[0].area + numtemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location = area).filter(status = 0).count() num = int(numtemp/2+0.5) all_complaint = [] - all_complainttemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location=a.area).order_by('-id') - j = 1 - for i in all_complainttemp: - all_complaint.append(i) - # if j%2 != 0: - # all_complaint.append(i) - # j = j + 1 - overduecomplaint = [] - for i in all_complaint: - if i.status != 2 and i.status != 3: - if i.complaint_finish < date.today(): - i.delay = date.today() - i.complaint_finish - overduecomplaint.append(i) + user_details=User.objects.get(id=y.user_id) + + + + + current_user = get_object_or_404(User, username=request.user.username) + y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() + user_details=User.objects.get(id=y.user_id) + des=HoldsDesignation.objects.filter(user=user_details).all() + # print(y.user_id) + # print(user_details.username) + # print(des[0].user) + outbox_files = view_outbox( + username=user_details.username, + designation=des[0].designation, + src_module="complaint" + ) + + outbox=[] + comp_list=set() + for i in outbox_files: + # print(i) + outbox.append(i) + + for i in outbox: + file_history = view_history(file_id=i['id']) + print(i['id']) + comp=File.objects.filter(id=i['id']) + print(comp[0].src_object_id) + complaint=StudentComplain.objects.all().filter(id=comp[0].src_object_id) + print(complaint) + comp_list.add(complaint) + # file_history = view_history(file_id=i['id']) + + # comp=File.objects.filter(uploader=file_history[0]['current_id']) + # for j in comp: + # c=StudentComplain.objects.all().filter(id=j.src_object_id) + # comp_list.add(c) + # print(c[0]) + + # break + complaint_final_list=[] + for i in comp_list: + complaint_final_list.append(i[0]) + sorted_history_out = sorted(complaint_final_list, key=attrgetter('complaint_date'), reverse=True) + + inbox_files = view_inbox( + username=user_details.username, + designation=des[0].designation, + src_module="complaint" + ) + inbox=[] + comp_list_in=set() + for i in inbox_files: + inbox.append(i) + # print(inbox[0]['id']) + + for i in inbox: + file_history = view_history(file_id=i['id']) + print(i['id']) + comp=File.objects.filter(id=i['id']) + print(comp[0].src_object_id) + complaint=StudentComplain.objects.all().filter(id=comp[0].src_object_id) + print(complaint) + comp_list_in.add(complaint) + # print(complaint[0]) + # for j in comp: + # c=StudentComplain.objects.all().filter(id=j.src_object_id) + # comp_list_in.add(c) + # print(c[0]) + + # break + complaint_final_list_in=[] + for i in comp_list_in: + complaint_final_list_in.append(i[0]) + + sorted_history = sorted(complaint_final_list_in, key=attrgetter('complaint_date'), reverse=True) + print(complaint_final_list_in) return render(request, "complaintModule/supervisor1.html", - {'all_caretaker': all_caretaker, 'all_complaint': all_complaint, - 'overduecomplaint': overduecomplaint, 'area': area, 'num' : num}) + + {'history':sorted_history,'all_caretaker': all_caretaker, 'all_complaint': all_complaint,'outbox':sorted_history_out}) @login_required def caretaker_id_know_more(request,caretaker_id): this_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(id = caretaker_id) - this_caretaker_area = this_caretaker.area; + this_caretaker_area = this_caretaker.area list_pending_complaints = [] - list_pending_complaintstemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location = this_caretaker_area).filter(status = 0) + list_pending_complaintstemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(location = this_caretaker_area).filter(status = 0) j = 1 for i in list_pending_complaintstemp: list_pending_complaints.append(i) - # if j%2 != 0: - # list_pending_complaints.append(i) - # j = j + 1 + - # num = StudentComplain.objects.filter(location = this_caretaker_area).filter(status = 0).count(); num = len(list_pending_complaints) return render(request, "complaintModule/caretaker_id_know_more.html",{'this_caretaker':this_caretaker , 'list_pending_complaints':list_pending_complaints, 'num':num}) @@ -911,6 +1243,36 @@ def search_complaint(request): @login_required def resolvepending(request, cid): + a = get_object_or_404(User, username=request.user.username) + y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() + thiscomplaint = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=cid) + if request.method == 'POST': + newstatus = request.POST.get('yesorno','') + comment = request.POST.get('comment') + intstatus = 0 + if newstatus == 'Yes': + intstatus = 2 + else: + intstatus = 3 + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=cid).\ + update(status=intstatus) + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=cid).\ + update(comment=comment) + complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=cid) + student=0 + message = "Congrats! Your complaint has been resolved" + complaint_system_notif(request.user, complainer_details.complainer.user ,'comp_resolved_alert',complainer_details.id,student,message) + return HttpResponseRedirect("/complaint/caretaker/") + else: + # complainer_details = StudentComplain.objects.get(id=cid) + # complaint_system_notif(request.user, complainer_details.complainer.user ,'comp_resolved_alert') + return render(request,"complaintModule/resolve_pending.html",{"a" : a,"thiscomplaint" : thiscomplaint}) + + + + +@login_required +def resolvependingsuper(request, cid): a = get_object_or_404(User, username=request.user.username) y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() thiscomplaint = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=cid) @@ -930,7 +1292,37 @@ def resolvepending(request, cid): student=0 message = "Congrats! Your complaint has been resolved" complaint_system_notif(request.user, complainer_details.complainer.user ,'comp_resolved_alert',complainer_details.id,student,message) - return HttpResponseRedirect("/complaint/caretaker/") + return HttpResponseRedirect("/complaint/supervisor/") + else: + # complainer_details = StudentComplain.objects.get(id=cid) + # complaint_system_notif(request.user, complainer_details.complainer.user ,'comp_resolved_alert') + return render(request,"complaintModule/resolve_pending.html",{"a" : a,"thiscomplaint" : thiscomplaint}) + + + + +@login_required +def resolvependingsuper(request, cid): + a = get_object_or_404(User, username=request.user.username) + y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() + thiscomplaint = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=cid) + if request.method == 'POST': + newstatus = request.POST.get('yesorno','') + comment = request.POST.get('comment') + intstatus = 0 + if newstatus == 'Yes': + intstatus = 2 + else: + intstatus = 3 + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=cid).\ + update(status=intstatus) + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=cid).\ + update(comment=comment) + complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=cid) + student=0 + message = "Congrats! Your complaint has been resolved" + complaint_system_notif(request.user, complainer_details.complainer.user ,'comp_resolved_alert',complainer_details.id,student,message) + return HttpResponseRedirect("/complaint/supervisor/") else: # complainer_details = StudentComplain.objects.get(id=cid) # complaint_system_notif(request.user, complainer_details.complainer.user ,'comp_resolved_alert') @@ -938,6 +1330,7 @@ def resolvepending(request, cid): + def login1(request): if request.method == 'POST': u = request.POST.get('username', '') @@ -956,10 +1349,10 @@ def login1(request): @login_required def feedback_super(request, feedcomp_id): - detail3 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=feedcomp_id) + detail3 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=feedcomp_id) a=User.objects.get(username=detail3.complainer.user.username) y=ExtraInfo.objects.all().select_related('user','department').get(user=a) - temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(complainer=y).first() comp_id=temp.id loc = detail3.location care = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=loc).first() @@ -968,47 +1361,49 @@ def feedback_super(request, feedcomp_id): @login_required def feedback_care(request, feedcomp_id): - detail2 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=feedcomp_id) + detail2 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=feedcomp_id) a=User.objects.get(username=detail2.complainer.user.username) y=ExtraInfo.objects.all().select_related('user','department').get(user=a) - temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(complainer=y).first() comp_id=temp.id return render(request, "complaintModule/feedback_care.html", {"detail2": detail2,"comp_id":comp_id}) - - +#for complainaint and caretaker @login_required def detail(request, detailcomp_id1): """ function that shows detail about complaint """ - detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=detailcomp_id1) + detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=detailcomp_id1) if(detail.worker_id is None): worker_name = None worker_id = detail.worker_id else: worker_id = detail.worker_id.id - worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=worker_id) + worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=worker_id) worker_name = worker.name a=User.objects.get(username=detail.complainer.user.username) y=ExtraInfo.objects.all().select_related('user','department').get(user=a) num=0 if detail.upload_complaint != "": num = 1 - temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(complainer=y).first() comp_id=temp.id return render(request, "complaintModule/complaint_user_detail.html", {"detail": detail, "comp_id":detail.id,"num":num,"worker_name":worker_name}) + + +#for SectionIncharge @login_required def detail2(request, detailcomp_id1): - detail2 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=detailcomp_id1) + detail2 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=detailcomp_id1) if(detail2.worker_id is None): worker_name = None worker_id = detail2.worker_id else: worker_id = detail2.worker_id.id - worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=worker_id) + worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=worker_id) worker_name = worker.name a=User.objects.get(username=detail2.complainer.user.username) y=ExtraInfo.objects.all().select_related('user','department').get(user=a) @@ -1016,20 +1411,474 @@ def detail2(request, detailcomp_id1): if detail2.upload_complaint != "": num = 1 - temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(complainer=y).first() comp_id=temp.id - return render(request, "complaintModule/complaint_caretaker_detail.html", {"detail2": detail2, "comp_id":detail2.id,"num":num,"worker_name":worker_name,"wid":worker_id}) + return render(request, "complaintModule/complaint_secincharge_detail.html", {"detail2": detail2, "comp_id":detail2.id,"num":num,"worker_name":worker_name,"wid":worker_id}) + @login_required def detail3(request, detailcomp_id1): - detail3 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=detailcomp_id1) + detail3 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=detailcomp_id1) a=User.objects.get(username=detail3.complainer.user.username) y=ExtraInfo.objects.all().select_related('user','department').get(user=a) num=0 if detail3.upload_complaint != "": num = 1 - temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(complainer=y).first() comp_id=temp.id loc = detail3.location care = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=loc).first() return render(request, "complaintModule/complaint_supervisor_detail.html", {"detail3": detail3,"comp_id":comp_id,"care":care,"num":num}) + + + + +@login_required + +def supervisorlodge(request): + """ + The function is used to register a complaint + @param: + request - trivial. + + + @variables: + issue - The issue object. + supported - True if the user's intention is to support the issue. + support_count - Total supporters of the above issue. + context - Holds data needed to make necessary changes in the template. + """ + a = get_object_or_404(User, username=request.user.username) + y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() + num = 1 + comp_id = y.id + if request.method == 'POST': + comp_type = request.POST.get('complaint_type', '') + location = request.POST.get('Location', '') + specific_location = request.POST.get('specific_location', '') + comp_file = request.FILES.get('myfile') + + details = request.POST.get('details', '') + status = 0 + # finish time is according to complaint type + complaint_finish = datetime.now() + timedelta(days=2) + if comp_type == 'Electricity': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'carpenter': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'plumber': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'garbage': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'dustbin': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'internet': + complaint_finish = datetime.now() + timedelta(days=4) + elif comp_type == 'other': + complaint_finish = datetime.now() + timedelta(days=3) + y = ExtraInfo.objects.all().select_related('user','department').get(id=comp_id) + #check if location given + if location!="": + # x = StudentComplain(complainer=y, + # complaint_type=comp_type, + # location=location, + # specific_location=specific_location, + # details=details, + # status=status, + # complaint_finish=complaint_finish, + # upload_complaint=comp_file) + + + # x.save() + obj1, created = StudentComplain.objects.get_or_create(complainer=y, + complaint_type=comp_type, + location=location, + specific_location=specific_location, + details=details, + status=status, + complaint_finish=complaint_finish, + upload_complaint=comp_file) + + + historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).order_by('-id') + history = [] + j = 1 + k = 1 + for i in historytemp: + history.append(i) + # if j%2 != 0: + # history.append(i) + # j = j+1 + + + for h in history: + h.serial_no = k + k = k+1 + # if location == "hall1": + # dsgn = "hall1caretaker" + # elif location == "hall3": + # dsgn = "hall3caretaker" + # else : + # dsgn = "hall4caretaker" + if location == "hall-1": + dsgn ="hall1caretaker" + elif location =="hall-3": + dsgn ="hall3caretaker" + elif location =="hall-4": + dsgn ="hall4caretaker" + elif location =="CC1": + dsgn ="cc1convener" + elif location =="CC2": + dsgn ="CC2 convener" + elif location == "core_lab": + dsgn = "corelabcaretaker" + elif location =="LHTC": + dsgn ="lhtccaretaker" + elif location =="NR2": + dsgn ="nr2caretaker" + elif location =="Maa Saraswati Hostel": + dsgn ="mshcaretaker" + elif location =="Nagarjun Hostel": + dsgn ="nhcaretaker" + elif location =="Panini Hostel": + dsgn ="phcaretaker" + else: + dsgn = "rewacaretaker" + caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = dsgn) + + + # This is to allow the student + student = 1 + message = "A New Complaint has been lodged" + complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert',obj1.id,student,message) + + # return render(request, "complaintModule/complaint_user.html", + # {'history': history, 'comp_id': comp_id }) + # next = request.POST.get('next', '/') + + messages.success(request,message) + return HttpResponseRedirect('/complaint/supervisor') + + else: + a = get_object_or_404(User, username=request.user.username) + y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() + historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).order_by('-id') + history=[] + + notification = Notification.objects.filter(recipient=a.id) + notification = notification.filter(data__exact={'url':'complaint:detail','module':'Complaint System'}) + # notification_message = [] + # for notification in x: + # to = User.objects.get(id=notification.actor_object_id).username + # from django.utils.timesince import timesince as timesince_ + # duration = timesince_(notification.timestamp,None) + # notification_message.append(notification.verb+' by '+ to + ' ' + duration + ' ago ') + + + + + j = 1 + for i in historytemp: + history.append(i) + # if j%2 != 0: + # history.append(i) + # j = j+1 + + for i in history: + i.serial_no = j + j = j+1 + + # if location == "hall-1": + # dsgn ="hall1caretaker" + # elif location =="hall-3": + # dsgn ="hall3caretaker" + # elif location =="hall-4": + # dsgn ="hall4caretaker" + # elif location =="CC1": + # dsgn ="CC convenor" + # elif location =="CC2": + # dsgn ="CC2 convener" + # elif location == "core_lab": + # dsgn = "corelabcaretaker" + # elif location =="LHTC": + # dsgn ="lhtccaretaker" + # elif location =="NR2": + # dsgn ="nr2caretaker" + # else: + # dsgn = "rewacaretaker" + # caretaker_name = HoldsDesignation.objects.get(designation__name = dsgn) + + # complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert') + return render(request, "complaintModule/supervisor1.html", + {'history': history,'notification':notification, 'comp_id': y.id}) + + return render(request, "complaintModule/complaint_user.html", + {'history': history, 'comp_id': comp_id }) + + + + +@login_required +def submitfeedbacksuper(request, complaint_id): + """ + The function is used by the complainant to enter feedback after the complaint has been resolved + @param: + request - trivial. + complaint_id - id of the registerd complaint. + + @variables: + issue - The issue object. + supported - True if the user's intention is to support the issue. + support_count - Total supporters of the above issue. + context - Holds data needed to make necessary changes in the template. + """ + + if request.method == 'POST': + feedback = request.POST.get('feedback', '') + rating = request.POST.get('rating', '') + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=complaint_id).\ + update(feedback=feedback, flag=rating) + a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=complaint_id).first() + care = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=a.location).first() + rate = care.rating + newrate = 0 + if rate == 0: + newrate = rating + else: + a1 = int(rating) + b1 = int(rate) + c1 = int((a1+b1)/2) + newrate = c1 + + Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=a.location).update(rating=newrate) + return HttpResponseRedirect('/complaint/supervisor/') + return render(request,"complaintModule/feedback.html",{'a' : a}) + + else: + a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=complaint_id) + return render(request, "complaintModule/submit_feedback.html", {'a': a}) + + + +@login_required + +def caretakerlodge(request): + """ + The function is used to register a complaint + @param: + request - trivial. + + + @variables: + issue - The issue object. + supported - True if the user's intention is to support the issue. + support_count - Total supporters of the above issue. + context - Holds data needed to make necessary changes in the template. + """ + a = get_object_or_404(User, username=request.user.username) + y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() + num = 1 + comp_id = y.id + if request.method == 'POST': + comp_type = request.POST.get('complaint_type', '') + location = request.POST.get('Location', '') + specific_location = request.POST.get('specific_location', '') + comp_file = request.FILES.get('myfile') + + details = request.POST.get('details', '') + status = 0 + # finish time is according to complaint type + complaint_finish = datetime.now() + timedelta(days=2) + if comp_type == 'Electricity': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'carpenter': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'plumber': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'garbage': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'dustbin': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'internet': + complaint_finish = datetime.now() + timedelta(days=4) + elif comp_type == 'other': + complaint_finish = datetime.now() + timedelta(days=3) + y = ExtraInfo.objects.all().select_related('user','department').get(id=comp_id) + #check if location given + if location!="": + # x = StudentComplain(complainer=y, + # complaint_type=comp_type, + # location=location, + # specific_location=specific_location, + # details=details, + # status=status, + # complaint_finish=complaint_finish, + # upload_complaint=comp_file) + + + # x.save() + obj1, created = StudentComplain.objects.get_or_create(complainer=y, + complaint_type=comp_type, + location=location, + specific_location=specific_location, + details=details, + status=status, + complaint_finish=complaint_finish, + upload_complaint=comp_file) + + + historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).order_by('-id') + history = [] + j = 1 + k = 1 + for i in historytemp: + history.append(i) + # if j%2 != 0: + # history.append(i) + # j = j+1 + + + for h in history: + h.serial_no = k + k = k+1 + # if location == "hall1": + # dsgn = "hall1caretaker" + # elif location == "hall3": + # dsgn = "hall3caretaker" + # else : + # dsgn = "hall4caretaker" + if location == "hall-1": + dsgn ="hall1caretaker" + elif location =="hall-3": + dsgn ="hall3caretaker" + elif location =="hall-4": + dsgn ="hall4caretaker" + elif location =="CC1": + dsgn ="cc1convener" + elif location =="CC2": + dsgn ="CC2 convener" + elif location == "core_lab": + dsgn = "corelabcaretaker" + elif location =="LHTC": + dsgn ="lhtccaretaker" + elif location =="NR2": + dsgn ="nr2caretaker" + elif location =="Maa Saraswati Hostel": + dsgn ="mshcaretaker" + elif location =="Nagarjun Hostel": + dsgn ="nhcaretaker" + elif location =="Panini Hostel": + dsgn ="phcaretaker" + else: + dsgn = "rewacaretaker" + caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = dsgn) + + + # This is to allow the student + student = 1 + message = "A New Complaint has been lodged" + complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert',obj1.id,student,message) + + # return render(request, "complaintModule/complaint_user.html", + # {'history': history, 'comp_id': comp_id }) + # next = request.POST.get('next', '/') + + messages.success(request,message) + return HttpResponseRedirect('/complaint/caretaker') + + else: + a = get_object_or_404(User, username=request.user.username) + y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() + historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).order_by('-id') + history=[] + + notification = Notification.objects.filter(recipient=a.id) + notification = notification.filter(data__exact={'url':'complaint:detail','module':'Complaint System'}) + # notification_message = [] + # for notification in x: + # to = User.objects.get(id=notification.actor_object_id).username + # from django.utils.timesince import timesince as timesince_ + # duration = timesince_(notification.timestamp,None) + # notification_message.append(notification.verb+' by '+ to + ' ' + duration + ' ago ') + + + + + j = 1 + for i in historytemp: + history.append(i) + # if j%2 != 0: + # history.append(i) + # j = j+1 + + for i in history: + i.serial_no = j + j = j+1 + + # if location == "hall-1": + # dsgn ="hall1caretaker" + # elif location =="hall-3": + # dsgn ="hall3caretaker" + # elif location =="hall-4": + # dsgn ="hall4caretaker" + # elif location =="CC1": + # dsgn ="CC convenor" + # elif location =="CC2": + # dsgn ="CC2 convener" + # elif location == "core_lab": + # dsgn = "corelabcaretaker" + # elif location =="LHTC": + # dsgn ="lhtccaretaker" + # elif location =="NR2": + # dsgn ="nr2caretaker" + # else: + # dsgn = "rewacaretaker" + # caretaker_name = HoldsDesignation.objects.get(designation__name = dsgn) + + # complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert') + return render(request, "complaintModule/complaint_caretaker.html", + {'history': history,'notification':notification, 'comp_id': y.id}) + + return render(request, "complaintModule/complaint_user.html", + {'history': history, 'comp_id': comp_id }) + + +@login_required +def submitfeedbackcaretaker(request, complaint_id): + """ + The function is used by the complainant to enter feedback after the complaint has been resolved + @param: + request - trivial. + complaint_id - id of the registerd complaint. + + @variables: + issue - The issue object. + supported - True if the user's intention is to support the issue. + support_count - Total supporters of the above issue. + context - Holds data needed to make necessary changes in the template. + """ + + if request.method == 'POST': + feedback = request.POST.get('feedback', '') + rating = request.POST.get('rating', '') + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=complaint_id).\ + update(feedback=feedback, flag=rating) + a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=complaint_id).first() + care = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=a.location).first() + rate = care.rating + newrate = 0 + if rate == 0: + newrate = rating + else: + a1 = int(rating) + b1 = int(rate) + c1 = int((a1+b1)/2) + newrate = c1 + + Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=a.location).update(rating=newrate) + return HttpResponseRedirect('/complaint/caretaker/') + return render(request,"complaintModule/feedback.html",{'a' : a}) + + else: + a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=complaint_id) + return render(request, "complaintModule/submit_feedback.html", {'a': a}) \ No newline at end of file diff --git a/FusionIIIT/applications/filetracking/tests.py b/FusionIIIT/applications/filetracking/tests.py index e9137c85e..a79ca8be5 100644 --- a/FusionIIIT/applications/filetracking/tests.py +++ b/FusionIIIT/applications/filetracking/tests.py @@ -1,3 +1,3 @@ -# from django.test import TestCase - -# Create your tests here. +# from django.test import TestCase + +# Create your tests here. diff --git a/FusionIIIT/applications/filetracking/urls.py b/FusionIIIT/applications/filetracking/urls.py index 6a3c24cf9..a451738de 100644 --- a/FusionIIIT/applications/filetracking/urls.py +++ b/FusionIIIT/applications/filetracking/urls.py @@ -1,46 +1,47 @@ -from django.conf.urls import url, include - -from . import views -from .api import urls - -app_name = 'filetracking' - -urlpatterns = [ - - url(r'^$', views.filetracking, name='filetracking'), - url(r'^draftdesign/$', views.draft_design, name='draft_design'), - url(r'^drafts/(?P\d+)$', views.drafts_view, name='drafts_view'), - url(r'^outbox/(?P\d+)$', views.outbox_view, name='outbox_view'), - url(r'^inbox/(?P\d+)$', views.inbox_view, name='inbox_view'), - url(r'^outward/$', views.outward, name='outward'), - url(r'^inward/$', views.inward, name='inward'), - url(r'^confirmdelete/(?P\d+)$', - views.confirmdelete, name='confirm_delete'), - url(r'^archive/(?P\d+)/$', views.archive_view, name='archive_view'), - url(r'^finish/(?P\d+)/$', views.archive_file, name='finish_file'), - url(r'^viewfile/(?P\d+)/$', views.view_file, name='view_file_view'), - url(r'^forward/(?P\d+)/$', views.forward, name='forward'), - url(r'^ajax/$', views.AjaxDropdown1, name='ajax_dropdown1'), - url(r'^ajax_dropdown/$', views.AjaxDropdown, name='ajax_dropdown'), - url(r'^test/$', views.test, name='test'), - url(r'^delete/(?P\d+)$', views.delete, name='delete'), - url(r'^forward_inward/(?P\d+)/$', - views.forward_inward, name='forward_inward'), - - # correction team 24 - url(r'^finish_design/$', views.finish_design, name='finish_design'), - url(r'^finish_fileview/(?P\d+)$', - views.finish_fileview, - name='finish_fileview'), - url(r'^archive_design/$', views.archive_design, name='archive_design'), - url(r'^archive_finish/(?P\d+)/$', - views.archive_finish, name='archive_finish'), - url(r'unarchive/(?P\d+)/$', - views.unarchive_file, name='unarchive'), - url(r'^getdesignations/(?P\w+)/$', views.get_designations_view, name="get_user_designations"), - url(r'^editdraft/(?P\w+)/$', views.edit_draft_view, name="edit_draft"), - - # REST api urls - url(r'^api/', include(urls)) - -] +from django.conf.urls import url, include + +from . import views +from .api import urls + +app_name = 'filetracking' + +urlpatterns = [ + + url(r'^$', views.filetracking, name='filetracking'), + url(r'^draftdesign/$', views.draft_design, name='draft_design'), + url(r'^drafts/(?P\d+)$', views.drafts_view, name='drafts_view'), + url(r'^outbox/(?P\d+)$', views.outbox_view, name='outbox_view'), + url(r'^inbox/(?P\d+)$', views.inbox_view, name='inbox_view'), + url(r'^outward/$', views.outward, name='outward'), + url(r'^inward/$', views.inward, name='inward'), + url(r'^confirmdelete/(?P\d+)$', + views.confirmdelete, name='confirm_delete'), + url(r'^archive/(?P\d+)/$', views.archive_view, name='archive_view'), + url(r'^finish/(?P\d+)/$', views.archive_file, name='finish_file'), + url(r'^viewfile/(?P\d+)/$', views.view_file, name='view_file_view'), + url(r'^forward/(?P\d+)/$', views.forward, name='forward'), + url(r'^ajax/$', views.AjaxDropdown1, name='ajax_dropdown1'), + url(r'^ajax_dropdown/$', views.AjaxDropdown, name='ajax_dropdown'), + url(r'^test/$', views.test, name='test'), + url(r'^delete/(?P\d+)$', views.delete, name='delete'), + url(r'^forward_inward/(?P\d+)/$', + views.forward_inward, name='forward_inward'), + + # correction team 24 + url(r'^finish_design/$', views.finish_design, name='finish_design'), + url(r'^finish_fileview/(?P\d+)$', + views.finish_fileview, + name='finish_fileview'), + url(r'^archive_design/$', views.archive_design, name='archive_design'), + url(r'^archive_finish/(?P\d+)/$', + views.archive_finish, name='archive_finish'), + url(r'unarchive/(?P\d+)/$', + views.unarchive_file, name='unarchive'), + url(r'^getdesignations/(?P\w+)/$', views.get_designations_view, name="get_user_designations"), + url(r'^editdraft/(?P\w+)/$', views.edit_draft_view, name="edit_draft"), + + # REST api urls + url(r'^api/', include(urls)) + +] + diff --git a/FusionIIIT/applications/globals/api/urls.py b/FusionIIIT/applications/globals/api/urls.py index 46ebd1ea0..0199f7688 100644 --- a/FusionIIIT/applications/globals/api/urls.py +++ b/FusionIIIT/applications/globals/api/urls.py @@ -7,7 +7,6 @@ url(r'^auth/login/', views.login, name='login-api'), url(r'^auth/logout/', views.logout, name='logout-api'), # generic profile endpoint - #code of corresponding view is modifiedtemporary because of mismatched designations url(r'^profile/(?P.+)/', views.profile, name='profile-api'), # current user profile url(r'^profile/', views.profile, name='profile-api'), @@ -15,6 +14,8 @@ url(r'^profile_delete/(?P[0-9]+)/', views.profile_delete, name='delete-profile-api'), url(r'^dashboard/',views.dashboard,name='dashboard-api'), + url(r'^notification/',views.notification,name='notification'), url(r'^notification/read',views.NotificationRead,name='notifications-read') -] + +] \ No newline at end of file diff --git a/FusionIIIT/applications/globals/api/views.py b/FusionIIIT/applications/globals/api/views.py index 3f30c1028..d6fc75321 100644 --- a/FusionIIIT/applications/globals/api/views.py +++ b/FusionIIIT/applications/globals/api/views.py @@ -17,7 +17,8 @@ from . import serializers - +from applications.globals.models import (ExtraInfo, Feedback, HoldsDesignation, + Issue, IssueImage, DepartmentInfo) from .utils import get_and_authenticate_user from notifications.models import Notification @@ -30,10 +31,33 @@ def login(request): serializer.is_valid(raise_exception=True) user = get_and_authenticate_user(**serializer.validated_data) data = serializers.AuthUserSerializer(user).data + print(user.id) + desig = list(HoldsDesignation.objects.select_related('user','working','designation').all().filter(working = user).values_list('designation')) + print(desig) + b = [i for sub in desig for i in sub] + design = HoldsDesignation.objects.select_related('user','designation').filter(working=user) + + designation=[] + + + + designation.append(str(user.extrainfo.user_type)) + for i in design: + if str(i.designation) != str(user.extrainfo.user_type): + print('-------') + print(i.designation) + print(user.extrainfo.user_type) + print('') + designation.append(str(i.designation)) + for i in designation: + print(i) + + resp = { 'success' : 'True', 'message' : 'User logged in successfully', - 'token' : data['auth_token'] + 'token' : data['auth_token'], + 'designations':designation } return Response(data=resp, status=status.HTTP_200_OK) @@ -71,20 +95,33 @@ def dashboard(request): return Response(data=resp,status=status.HTTP_200_OK) +@api_view(['GET']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def notification(request): + + print(request) + notifications=serializers.NotificationSerializer(request.user.notifications.all(),many=True).data + print("get") + print(notifications) + + resp={ + 'notifications':notifications, + } + + return Response(data=resp,status=status.HTTP_200_OK) + @api_view(['GET']) def profile(request, username=None): user = get_object_or_404(User, username=username) if username else request.user user_detail = serializers.UserSerializer(user).data profile = serializers.ExtraInfoSerializer(user.extrainfo).data - - print(user) - if profile['user_type'] == 'student': student = user.extrainfo.student skills = serializers.HasSerializer(student.has_set.all(),many=True).data education = serializers.EducationSerializer(student.education_set.all(), many=True).data course = serializers.CourseSerializer(student.course_set.all(), many=True).data - experience = serializers.ExperienceSerializer(student.experience_set.all(), many=True).datap + experience = serializers.ExperienceSerializer(student.experience_set.all(), many=True).data project = serializers.ProjectSerializer(student.project_set.all(), many=True).data achievement = serializers.AchievementSerializer(student.achievement_set.all(), many=True).data publication = serializers.PublicationSerializer(student.publication_set.all(), many=True).data @@ -105,7 +142,6 @@ def profile(request, username=None): } return Response(data=resp, status=status.HTTP_200_OK) elif profile['user_type'] == 'faculty': - print(username) return redirect('/eis/api/profile/' + (username+'/' if username else '')) @api_view(['PUT']) @@ -259,4 +295,4 @@ def NotificationRead(request): response ={ 'error':'Failed, notification is not marked as seen.' } - return Response(response,status=status.HTTP_404_NOT_FOUND) + return Response(response,status=status.HTTP_404_NOT_FOUND) \ No newline at end of file diff --git a/FusionIIIT/applications/health_center/admin.py b/FusionIIIT/applications/health_center/admin.py index 6153211ad..7299eff00 100644 --- a/FusionIIIT/applications/health_center/admin.py +++ b/FusionIIIT/applications/health_center/admin.py @@ -14,7 +14,8 @@ admin.site.register(Prescription) admin.site.register(Medicine) admin.site.register(Prescribed_medicine) -admin.site.register(Schedule) +admin.site.register(Doctors_Schedule) +admin.site.register(Pathologist_Schedule) admin.site.register(Announcements) admin.site.register(SpecialRequest) admin.site.register(Pathologist) \ No newline at end of file diff --git a/FusionIIIT/applications/health_center/api/serializers.py b/FusionIIIT/applications/health_center/api/serializers.py index 11dda4d87..13aa9f049 100644 --- a/FusionIIIT/applications/health_center/api/serializers.py +++ b/FusionIIIT/applications/health_center/api/serializers.py @@ -41,11 +41,18 @@ class Meta: model=Expiry fields=('__all__') -class ScheduleSerializer(serializers.ModelSerializer): +class DoctorsScheduleSerializer(serializers.ModelSerializer): class Meta: - model=Schedule + model=Doctors_Schedule fields=('__all__') +class PathologistScheduleSerializer(serializers.ModelSerializer): + + class Meta: + model=Pathologist_Schedule + fields=('__all__') + + class AnnouncementSerializer(serializers.ModelSerializer): diff --git a/FusionIIIT/applications/health_center/api/views.py b/FusionIIIT/applications/health_center/api/views.py index de9e2d76f..f82665a69 100644 --- a/FusionIIIT/applications/health_center/api/views.py +++ b/FusionIIIT/applications/health_center/api/views.py @@ -57,7 +57,7 @@ def student_request_api(request): doctor_id = request.data['doctor_id'] except: return Response({'message': 'Please enter doctor id'}, status=status.HTTP_404_NOT_FOUND) - request.data['schedule'] =get_object_or_404(Schedule,doctor_id=request.data['doctor_id'],day=day).id + request.data['schedule'] =get_object_or_404(Doctors_Schedule,doctor_id=request.data['doctor_id'],day=day).id comp_id = ExtraInfo.objects.filter(user_type='compounder') serializer = serializers.AppointmentSerializer(data=request.data) if serializer.is_valid(): @@ -109,7 +109,7 @@ def student_view_api(request): medicines = serializers.PrescribedMedicineSerializer(Prescribed_medicine.objects.all(),many=True).data complaints = serializers.ComplaintSerializer(Complaint.objects.filter(user_id=user_id).order_by('-date'),many=True).data days = Constants.DAYS_OF_WEEK - schedule=serializers.ScheduleSerializer(Schedule.objects.all().order_by('doctor_id'),many=True).data + schedule=serializers.ScheduleSerializer(Doctors_Schedule.objects.all().order_by('doctor_id'),many=True).data doctors=serializers.DoctorSerializer(Doctor.objects.filter(active=True),many=True).data count=Counter.objects.all() if count: @@ -170,11 +170,11 @@ def compounder_request_api(request): day = request.data['day'] except: return Response({'message': 'Please enter valid day'}, status=status.HTTP_404_NOT_FOUND) - sc = Schedule.objects.filter(doctor_id=doctor_id, day=day) + sc = Doctor.objects.filter(doctor_id=doctor_id, day=day) if sc.count() == 0: serializer = serializers.ScheduleSerializer(data=request.data) else: - sc = get_object_or_404(Schedule,doctor_id=doctor_id,day=day) + sc = get_object_or_404(Doctors_Schedule,doctor_id=doctor_id,day=day) serializer = serializers.ScheduleSerializer(sc,data=request.data,partial=True) if serializer.is_valid(): serializer.save() @@ -190,7 +190,7 @@ def compounder_request_api(request): day = request.data['day'] except: return Response({'message': 'Please enter valid day'}, status=status.HTTP_404_NOT_FOUND) - sc = get_object_or_404(Schedule,doctor_id=doctor_id,day=day) + sc = get_object_or_404(Doctors_Schedule,doctor_id=doctor_id,day=day) sc.delete() resp={'message':'Schedule Deleted successfully'} return Response(data=resp,status=status.HTTP_200_OK) @@ -326,7 +326,7 @@ def compounder_view_api(request): appointments_future= serializers.AppointmentSerializer(Appointment.objects.filter(date__gt=datetime.now()).order_by('date'),many=True).data stocks = serializers.StockSerializer(Stock.objects.all(),many=True).data days = Constants.DAYS_OF_WEEK - schedule= serializers.ScheduleSerializer(Schedule.objects.all().order_by('doctor_id'),many=True).data + schedule= serializers.ScheduleSerializer(Doctors_Schedule.objects.all().order_by('doctor_id'),many=True).data expired= serializers.ExpirySerializer(Expiry.objects.filter(expiry_date__lt=datetime.now(),returned=False).order_by('expiry_date'),many=True).data live_meds= serializers.ExpirySerializer(Expiry.objects.filter(returned=False).order_by('quantity'),many=True).data count= Counter.objects.all() @@ -338,7 +338,7 @@ def compounder_view_api(request): Counter.objects.create(count=0,fine=0) count= serializers.CounterSerializer(Counter.objects.get()).data hospitals=serializers.HospitalSerializer(Hospital.objects.all(),many=True).data - schedule= serializers.ScheduleSerializer(Schedule.objects.all().order_by('day','doctor_id'),many=True).data + schedule= serializers.ScheduleSerializer(Doctors_Schedule.objects.all().order_by('day','doctor_id'),many=True).data doctors= serializers.DoctorSerializer(Doctor.objects.filter(active=True).order_by('id'),many=True).data resp= {'days': days, 'count': count,'expired':expired, @@ -350,5 +350,4 @@ def compounder_view_api(request): else: resp = {'message': 'invalid request'} - return Response(data=resp,status=status.HTTP_404_NOT_FOUND) # compounder view ends - + return Response(data=resp,status=status.HTTP_404_NOT_FOUND) # compounder view ends \ No newline at end of file diff --git a/FusionIIIT/applications/health_center/models.py b/FusionIIIT/applications/health_center/models.py index 0c2d6dc39..b22410cd4 100644 --- a/FusionIIIT/applications/health_center/models.py +++ b/FusionIIIT/applications/health_center/models.py @@ -31,7 +31,7 @@ class Constants: class Doctor(models.Model): doctor_name = models.CharField(choices=Constants.NAME_OF_DOCTOR, max_length=50) - doctor_phone = models.IntegerField(max_length=10) + doctor_phone = models.CharField(max_length=15) specialization = models.CharField(max_length=100) active = models.BooleanField(default=True) @@ -40,7 +40,7 @@ def __str__(self): class Pathologist(models.Model): pathologist_name = models.CharField(choices=Constants.NAME_OF_PATHOLOGIST, max_length=50) - pathologist_phone = models.IntegerField(max_length=10) + pathologist_phone = models.CharField(max_length=15) specialization = models.CharField(max_length=100) active = models.BooleanField(default=True) @@ -94,14 +94,24 @@ class Expiry(models.Model): def __str__(self): return self.medicine_id.medicine_name -class Schedule(models.Model): - doctor_id = models.ForeignKey(Doctor,on_delete=models.CASCADE, default=0) - pathologist_id = models.ForeignKey(Pathologist,on_delete=models.CASCADE, default=0) +class Doctors_Schedule(models.Model): + doctor_id = models.ForeignKey(Doctor,on_delete=models.CASCADE) + # pathologist_id = models.ForeignKey(Pathologist,on_delete=models.CASCADE, default=0) + day = models.CharField(choices=Constants.DAYS_OF_WEEK, max_length=10) + from_time = models.TimeField(null=True,blank=True) + to_time = models.TimeField(null=True,blank=True) + room = models.IntegerField() + date = models.DateField(auto_now=True) + +class Pathologist_Schedule(models.Model): + # doctor_id = models.ForeignKey(Doctor,on_delete=models.CASCADE) + pathologist_id = models.ForeignKey(Pathologist,on_delete=models.CASCADE) day = models.CharField(choices=Constants.DAYS_OF_WEEK, max_length=10) from_time = models.TimeField(null=True,blank=True) to_time = models.TimeField(null=True,blank=True) room = models.IntegerField() date = models.DateField(auto_now=True) + @@ -147,7 +157,7 @@ class Appointment(models.Model): user_id = models.ForeignKey(ExtraInfo,on_delete=models.CASCADE) doctor_id = models.ForeignKey(Doctor,on_delete=models.CASCADE) description = models.CharField(max_length=50) - schedule = models.ForeignKey(Schedule, on_delete=models.CASCADE,null=True, blank=True) + schedule = models.ForeignKey(Doctors_Schedule, on_delete=models.CASCADE,null=True, blank=True) date = models.DateField() def __str__(self): @@ -160,7 +170,7 @@ class Prescription(models.Model): details = models.CharField(max_length=100) date = models.DateField() test = models.CharField(max_length=200, null=True, blank=True) - appointment = models.ForeignKey(Appointment, on_delete=models.CASCADE,null=True, blank=True) + # appointment = models.ForeignKey(Appointment, on_delete=models.CASCADE,null=True, blank=True) def __str__(self): return self.details diff --git a/FusionIIIT/applications/health_center/urls.py b/FusionIIIT/applications/health_center/urls.py index b70110a7f..a3969188e 100644 --- a/FusionIIIT/applications/health_center/urls.py +++ b/FusionIIIT/applications/health_center/urls.py @@ -16,7 +16,8 @@ url(r'announcement/', announcement, name='announcement'), #database entry - url(r'^schedule_entry', schedule_entry, name='schedule_entry'), + + url(r'^doctor_entry', doctor_entry, name='doctor_entry'), url(r'^compounder_entry', compounder_entry, name='compounder_entry'), diff --git a/FusionIIIT/applications/health_center/utils.py b/FusionIIIT/applications/health_center/utils.py index 6f0948a54..e0ec56c75 100644 --- a/FusionIIIT/applications/health_center/utils.py +++ b/FusionIIIT/applications/health_center/utils.py @@ -6,7 +6,7 @@ from notification.views import healthcare_center_notif from .models import (Ambulance_request, Appointment, Complaint, Doctor, Expiry, Hospital, Hospital_admit, Medicine, - Prescribed_medicine, Prescription, Schedule, + Prescribed_medicine, Prescription, Doctors_Schedule,Pathologist_Schedule, Stock, Announcements, SpecialRequest, Pathologist) def datetime_handler(date): @@ -81,15 +81,15 @@ def compounder_view_handler(request): return JsonResponse(data) # making announcements from compounder - # elif 'add' in request.POST: - # ven=request.POST.get('venue') - # announcement=request.POST.get('announcement') - # Announcement.objects.create( - # venue=ven, - # announcement=announcement, - # ) - # data={ 'venue':ven, 'announcement':announcement } - # return JsonResponse(data) + elif 'add' in request.POST: + ven=request.POST.get('venue') + announcement=request.POST.get('announcement') + Announcement.objects.create( + venue=ven, + announcement=announcement, + ) + data={ 'venue':ven, 'announcement':announcement } + return JsonResponse(data) # remove doctor by changing active status elif 'remove_doctor' in request.POST: @@ -145,15 +145,15 @@ def compounder_view_handler(request): time_in = request.POST.get('time_in') time_out = request.POST.get('time_out') room = request.POST.get('room') - schedule = Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor, day=day) + schedule = Doctors_Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor, day=day) doctor_id = Doctor.objects.get(id=doctor) if schedule.count() == 0: - Schedule.objects.create(doctor_id=doctor_id, day=day, room=room, + Doctors_Schedule.objects.create(doctor_id=doctor_id, day=day, room=room, from_time=time_in, to_time=time_out) else: - Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor_id, day=day).update(room=room) - Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor_id, day=day).update(from_time=time_in) - Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor_id, day=day).update(to_time=time_out) + Doctors_Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor_id, day=day).update(room=room) + Doctors_Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor_id, day=day).update(from_time=time_in) + Doctors_Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor_id, day=day).update(to_time=time_out) data={'status':1} return JsonResponse(data) @@ -163,7 +163,7 @@ def compounder_view_handler(request): doctor = request.POST.get('doctor') day = request.POST.get('day') - Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor, day=day).delete() + Doctors_Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor, day=day).delete() data = {'status': 1} return JsonResponse(data) @@ -176,14 +176,14 @@ def compounder_view_handler(request): time_out = request.POST.get('time_out') room = request.POST.get('room') pathologist_id = Pathologist.objects.get(id=doctor) - schedule = Schedule.objects.select_related('pathologist_id').filter(pathologist_id=doctor, day=day) + schedule = Pathologist_Schedule.objects.select_related('pathologist_id').filter(pathologist_id=doctor, day=day) if schedule.count() == 0: - Schedule.objects.create(pathologist_id=pathologist_id, day=day, room=room, + Pathologist_Schedule.objects.create(pathologist_id=pathologist_id, day=day, room=room, from_time=time_in, to_time=time_out) else: - Schedule.objects.select_related('pathologist_id').filter(pathologist_id=pathologist_id, day=day).update(room=room) - Schedule.objects.select_related('pathologist_id').filter(pathologist_id=pathologist_id, day=day).update(from_time=time_in) - Schedule.objects.select_related('pathologist_id').filter(pathologist_id=pathologist_id, day=day).update(to_time=time_out) + Pathologist_Schedule.objects.select_related('pathologist_id').filter(pathologist_id=pathologist_id, day=day).update(room=room) + Pathologist_Schedule.objects.select_related('pathologist_id').filter(pathologist_id=pathologist_id, day=day).update(from_time=time_in) + Pathologist_Schedule.objects.select_related('pathologist_id').filter(pathologist_id=pathologist_id, day=day).update(to_time=time_out) data={'status':1} return JsonResponse(data) @@ -193,7 +193,7 @@ def compounder_view_handler(request): doctor = request.POST.get('pathologist') day = request.POST.get('day') - Schedule.objects.select_related('pathologist_id').filter(pathologist_id=doctor, day=day).delete() + Pathologist_Schedule.objects.select_related('pathologist_id').filter(pathologist_id=doctor, day=day).delete() data = {'status': 1} return JsonResponse(data) @@ -372,21 +372,21 @@ def compounder_view_handler(request): doctor = Doctor.objects.get(id=doctor_id) details = request.POST.get('details') tests = request.POST.get('tests') - app = Appointment.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','schedule','schedule__doctor_id').filter(user_id=user_id,date=datetime.now()) - if app: - appointment = Appointment.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','schedule','schedule__doctor_id').get(user_id=user_id,date=datetime.now()) - else: - appointment = None + # app = Appointment.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','schedule','schedule__doctor_id').filter(user_id=user_id,date=datetime.now()) + # if app: + # appointment = Appointment.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','schedule','schedule__doctor_id').get(user_id=user_id,date=datetime.now()) + # else: + # appointment = None Prescription.objects.create( user_id=user, doctor_id=doctor, details=details, date=datetime.now(), test=tests, - appointment=appointment + # appointment=appointment ) query = Medicine.objects.select_related('patient','patient__user','patient__department').filter(patient=user) - prescribe = Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','appointment','appointment__user_id','appointment__user_id__user','appointment__user_id__department','appointment__doctor_id','appointment__schedule','appointment__schedule__doctor_id').all().last() + prescribe = Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id').all().last() for medicine in query: medicine_id = medicine.medicine_id quantity = medicine.quantity @@ -431,7 +431,7 @@ def compounder_view_handler(request): return JsonResponse(data) elif 'cancel_presc' in request.POST: presc_id = request.POST.get('cancel_presc') - Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','appointment','appointment__user_id','appointment__user_id__user','appointment__user_id__department','appointment__doctor_id','appointment__schedule','appointment__schedule__doctor_id').filter(pk=presc_id).delete() + Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id').filter(pk=presc_id).delete() data = {'status': 1} return JsonResponse(data) elif 'medicine' in request.POST: @@ -492,10 +492,10 @@ def student_view_handler(request): elif 'doctor' in request.POST: doctor_id = request.POST.get('doctor') - days = Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor_id).values('day') + days =Dotors_Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor_id).values('day') today = datetime.today() time = datetime.today().time() - sch = Schedule.objects.select_related('doctor_id').filter(date__gte=today) + sch = Doctors_Schedule.objects.select_related('doctor_id').filter(date__gte=today) for day in days: for i in range(0, 7): @@ -504,7 +504,7 @@ def student_view_handler(request): d = day.get('day') if dayi == d: - Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor_id, day=dayi).update(date=date) + Doctors_Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor_id, day=dayi).update(date=date) sch.filter(date=today, to_time__lt=time).delete() schedule = sch.filter(doctor_id=doctor_id).order_by('date') @@ -531,4 +531,4 @@ def student_view_handler(request): app_id = request.POST.get('cancel_app') Appointment.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','schedule','schedule__doctor_id').filter(pk=app_id).delete() data = {'status': 1} - return JsonResponse(data) + return JsonResponse(data) \ No newline at end of file diff --git a/FusionIIIT/applications/health_center/views.py b/FusionIIIT/applications/health_center/views.py index 6e32d7b87..8ded8b462 100644 --- a/FusionIIIT/applications/health_center/views.py +++ b/FusionIIIT/applications/health_center/views.py @@ -12,7 +12,7 @@ from notification.views import healthcare_center_notif from .models import (Ambulance_request, Appointment, Complaint, Constants, Counter, Doctor,Pathologist, Expiry, Hospital, Hospital_admit, - Medicine, Prescribed_medicine, Prescription, Schedule, + Medicine, Prescribed_medicine, Prescription, Doctors_Schedule,Pathologist_Schedule, Stock,SpecialRequest,Announcements) from .utils import datetime_handler, compounder_view_handler, student_view_handler @@ -80,20 +80,20 @@ def compounder_view(request): users = ExtraInfo.objects.select_related('user','department').filter(user_type='student') stocks = Stock.objects.all() days = Constants.DAYS_OF_WEEK - schedule=Schedule.objects.select_related('doctor_id').all().order_by('doctor_id') - schedule1=Schedule.objects.select_related('pathologist_id').all().order_by('pathologist_id') + schedule=Doctors_Schedule.objects.select_related('doctor_id').all().order_by('doctor_id') + schedule1=Pathologist_Schedule.objects.select_related('pathologist_id').all().order_by('pathologist_id') expired=Expiry.objects.select_related('medicine_id').filter(expiry_date__lt=datetime.now(),returned=False).order_by('expiry_date') live_meds=Expiry.objects.select_related('medicine_id').filter(returned=False).order_by('quantity') count=Counter.objects.all() - presc_hist=Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','appointment','appointment__user_id','appointment__user_id__user','appointment__user_id__department','appointment__doctor_id','appointment__schedule','appointment__schedule__doctor_id').all().order_by('-date') - medicines_presc=Prescribed_medicine.objects.select_related('prescription_id','prescription_id__user_id','prescription_id__user_id__user','prescription_id__user_id__department','prescription_id__doctor_id','prescription_id__appointment','prescription_id__appointment__user_id','prescription_id__appointment__user_id__user','prescription_id__appointment__user_id__department','prescription_id__appointment__doctor_id','prescription_id__appointment__schedule','prescription_id__appointment__schedule__doctor_id','medicine_id').all() + presc_hist=Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id').all().order_by('-date') + medicines_presc=Prescribed_medicine.objects.select_related('prescription_id','prescription_id__user_id','prescription_id__user_id__user','prescription_id__user_id__department','prescription_id__doctor_id').all() if count: Counter.objects.all().delete() Counter.objects.create(count=0,fine=0) count=Counter.objects.get() hospitals=Hospital.objects.all() - schedule=Schedule.objects.select_related('doctor_id').all().order_by('day','doctor_id') - schedule1=Schedule.objects.select_related('pathologist_id').all().order_by('day','pathologist_id') + schedule=Doctors_Schedule.objects.select_related('doctor_id').all().order_by('day','doctor_id') + schedule1=Pathologist_Schedule.objects.select_related('pathologist_id').all().order_by('day','pathologist_id') doctors=Doctor.objects.filter(active=True).order_by('id') pathologists=Pathologist.objects.filter(active=True).order_by('id') @@ -142,12 +142,12 @@ def student_view(request): hospitals = Hospital_admit.objects.select_related('user_id','user_id__user','user_id__department','doctor_id').filter(user_id=user_id).order_by('-admission_date') appointments = Appointment.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','schedule','schedule__doctor_id').filter(user_id=user_id).order_by('-date') ambulances = Ambulance_request.objects.select_related('user_id','user_id__user','user_id__department').filter(user_id=user_id).order_by('-date_request') - prescription = Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','appointment','appointment__user_id','appointment__user_id__user','appointment__user_id__department','appointment__doctor_id','appointment__schedule','appointment__schedule__doctor_id').filter(user_id=user_id).order_by('-date') - medicines = Prescribed_medicine.objects.select_related('prescription_id','prescription_id__user_id','prescription_id__user_id__user','prescription_id__user_id__department','prescription_id__doctor_id','prescription_id__appointment','prescription_id__appointment__user_id','prescription_id__appointment__user_id__user','prescription_id__appointment__user_id__department','prescription_id__appointment__doctor_id','prescription_id__appointment__schedule','prescription_id__appointment__schedule__doctor_id','medicine_id').all() + prescription = Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id').filter(user_id=user_id).order_by('-date') + medicines = Prescribed_medicine.objects.select_related('prescription_id','prescription_id__user_id','prescription_id__user_id__user','prescription_id__user_id__department','prescription_id__doctor_id','medicine_id').all() complaints = Complaint.objects.select_related('user_id','user_id__user','user_id__department').filter(user_id=user_id).order_by('-date') days = Constants.DAYS_OF_WEEK - schedule=Schedule.objects.select_related('doctor_id').all().order_by('doctor_id') - schedule1=Schedule.objects.select_related('pathologist_id').all().order_by('pathologist_id') + schedule=Doctors_Schedule.objects.select_related('doctor_id').all().order_by('doctor_id') + schedule1=Pathologist_Schedule.objects.select_related('pathologist_id').all().order_by('pathologist_id') doctors=Doctor.objects.filter(active=True) pathologists=Pathologist.objects.filter(active=True) diff --git a/FusionIIIT/applications/programme_curriculum/models.py b/FusionIIIT/applications/programme_curriculum/models.py index ee993363e..908afec30 100644 --- a/FusionIIIT/applications/programme_curriculum/models.py +++ b/FusionIIIT/applications/programme_curriculum/models.py @@ -61,7 +61,7 @@ class Programme(models.Model): name = models.CharField(max_length=70, null=False, unique=True, blank=False) programme_begin_year = models.PositiveIntegerField(default=datetime.date.today().year, null=False) - def __str__(self): + def _str_(self): return str(self.category + " - "+ self.name) @property @@ -92,7 +92,7 @@ class Discipline(models.Model): acronym = models.CharField(max_length=10, null=False, default="", blank=False) programmes = models.ManyToManyField(Programme, blank=True) - def __str__(self): + def _str_(self): return str(self.name) + " " + str(self.acronym) @property @@ -119,11 +119,13 @@ class Curriculum(models.Model): ''' programme = models.ForeignKey(Programme, on_delete=models.CASCADE, null=False) name = models.CharField(max_length=100, null=False, blank=False) + # version = models.FloatField(default=1.0, null=False) # version = models.PositiveIntegerField(default=1, null=False) version = models.DecimalField( max_digits=2, decimal_places=1, + default=1.0, validators=[MinValueValidator(1.0), DecimalValidator(max_digits=2, decimal_places=1)]) working_curriculum = models.BooleanField(default=True, null=False) @@ -133,7 +135,7 @@ class Curriculum(models.Model): class Meta: unique_together = ('name', 'version',) - def __str__(self): + def _str_(self): return str(self.name + " v" + str(self.version)) @property @@ -174,8 +176,8 @@ class Semester(models.Model): class Meta: unique_together = ('curriculum', 'semester_no',) - def __str__(self): - return str(Curriculum.__str__(self.curriculum) + ", sem-" + str(self.semester_no)) + def _str_(self): + return str(Curriculum._str_(self.curriculum) + ", sem-" + str(self.semester_no)) @property def courseslots(self): @@ -184,7 +186,7 @@ def courseslots(self): class Course(models.Model): ''' Current Purpose : To store the details regarding a course - + @@ -218,10 +220,12 @@ class Course(models.Model): code = models.CharField(max_length=10, null=False, blank=False) name = models.CharField(max_length=100, null=False, blank=False) version = models.DecimalField( + max_digits=5, decimal_places=1, default=1.0, validators=[MinValueValidator(1.0), DecimalValidator(max_digits=5, decimal_places=1)]) + credit = models.PositiveIntegerField(default=0, null=False, blank=False) lecture_hours = PositiveIntegerField(null=True, ) tutorial_hours = PositiveIntegerField(null=True) @@ -246,7 +250,9 @@ class Course(models.Model): class Meta: unique_together = ('code','version') + def __str__(self): + return str(self.code + " - " +self.name+"- v"+str(self.version)) @@ -283,7 +289,7 @@ class Batch(models.Model): class Meta: unique_together = ('name', 'discipline', 'year',) - def __str__(self): + def _str_(self): return str(self.name) + " " + str(self.discipline.acronym) + " " + str(self.year) @@ -314,8 +320,8 @@ class CourseSlot(models.Model): max_registration_limit = models.PositiveIntegerField(default = 1000) - def __str__(self): - return str(Semester.__str__(self.semester) + ", " + self.name) + def _str_(self): + return str(Semester._str_(self.semester) + ", " + self.name) class Meta: unique_together = ('semester', 'name', 'type') @@ -475,3 +481,4 @@ def __str__(self): # def courseslots(self): # return CourseSlot.objects.filter(courses=self.id) + diff --git a/FusionIIIT/media/0.98MB.png b/FusionIIIT/media/0.98MB.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_57t5s4b.png b/FusionIIIT/media/0.98MB_57t5s4b.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_57t5s4b.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_7FiXoj8.png b/FusionIIIT/media/0.98MB_7FiXoj8.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_7FiXoj8.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_L99QaqW.png b/FusionIIIT/media/0.98MB_L99QaqW.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_L99QaqW.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_LMwYOps.png b/FusionIIIT/media/0.98MB_LMwYOps.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_LMwYOps.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_P93Gzkf.png b/FusionIIIT/media/0.98MB_P93Gzkf.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_P93Gzkf.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_b8VDHuo.png b/FusionIIIT/media/0.98MB_b8VDHuo.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_b8VDHuo.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_e6cGhm4.png b/FusionIIIT/media/0.98MB_e6cGhm4.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_e6cGhm4.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_ib1hWcs.png b/FusionIIIT/media/0.98MB_ib1hWcs.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_ib1hWcs.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_igbRwIm.png b/FusionIIIT/media/0.98MB_igbRwIm.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_igbRwIm.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_jTd86LL.png b/FusionIIIT/media/0.98MB_jTd86LL.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_jTd86LL.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_jXilZaV.png b/FusionIIIT/media/0.98MB_jXilZaV.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_jXilZaV.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_o5whyyv.png b/FusionIIIT/media/0.98MB_o5whyyv.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_o5whyyv.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_oPouQfP.png b/FusionIIIT/media/0.98MB_oPouQfP.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_oPouQfP.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_oQkgkRh.png b/FusionIIIT/media/0.98MB_oQkgkRh.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_oQkgkRh.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_pmemS4n.png b/FusionIIIT/media/0.98MB_pmemS4n.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_pmemS4n.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_qXDyVYy.png b/FusionIIIT/media/0.98MB_qXDyVYy.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_qXDyVYy.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_rNj6b4q.png b/FusionIIIT/media/0.98MB_rNj6b4q.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_rNj6b4q.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_tz69HNE.png b/FusionIIIT/media/0.98MB_tz69HNE.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_tz69HNE.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_utFsMj9.png b/FusionIIIT/media/0.98MB_utFsMj9.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_utFsMj9.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_xIcO1Zb.png b/FusionIIIT/media/0.98MB_xIcO1Zb.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_xIcO1Zb.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_yoy2RBN.png b/FusionIIIT/media/0.98MB_yoy2RBN.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_yoy2RBN.png and /dev/null differ diff --git a/FusionIIIT/media/0.99MB.jpg b/FusionIIIT/media/0.99MB.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_DHG7YXd.jpg b/FusionIIIT/media/0.99MB_DHG7YXd.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_DHG7YXd.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_EGLIPZ2.jpg b/FusionIIIT/media/0.99MB_EGLIPZ2.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_EGLIPZ2.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_HHduay1.jpg b/FusionIIIT/media/0.99MB_HHduay1.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_HHduay1.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_JTYIGIj.jpg b/FusionIIIT/media/0.99MB_JTYIGIj.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_JTYIGIj.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_aAwWnr2.jpg b/FusionIIIT/media/0.99MB_aAwWnr2.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_aAwWnr2.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_e0LQOmD.jpg b/FusionIIIT/media/0.99MB_e0LQOmD.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_e0LQOmD.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_lsfSTir.jpg b/FusionIIIT/media/0.99MB_lsfSTir.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_lsfSTir.jpg and /dev/null differ diff --git a/FusionIIIT/media/1.png b/FusionIIIT/media/1.png deleted file mode 100644 index 9c8220bd3..000000000 Binary files a/FusionIIIT/media/1.png and /dev/null differ diff --git a/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g.jpeg b/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g.jpeg deleted file mode 100644 index 83a35d102..000000000 Binary files a/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g.jpeg and /dev/null differ diff --git a/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g_5F4vkCu.jpeg b/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g_5F4vkCu.jpeg deleted file mode 100644 index 83a35d102..000000000 Binary files a/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g_5F4vkCu.jpeg and /dev/null differ diff --git a/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g_792jnyr.jpeg b/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g_792jnyr.jpeg deleted file mode 100644 index 83a35d102..000000000 Binary files a/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g_792jnyr.jpeg and /dev/null differ diff --git a/FusionIIIT/media/48KB.jpg b/FusionIIIT/media/48KB.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/48KB.jpg and /dev/null differ diff --git a/FusionIIIT/media/48KB_2JSfQTH.jpg b/FusionIIIT/media/48KB_2JSfQTH.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/48KB_2JSfQTH.jpg and /dev/null differ diff --git a/FusionIIIT/media/48KB_PmnwtUs.jpg b/FusionIIIT/media/48KB_PmnwtUs.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/48KB_PmnwtUs.jpg and /dev/null differ diff --git a/FusionIIIT/media/48KB_TISNA0m.jpg b/FusionIIIT/media/48KB_TISNA0m.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/48KB_TISNA0m.jpg and /dev/null differ diff --git a/FusionIIIT/media/48KB_TyyHR1E.jpg b/FusionIIIT/media/48KB_TyyHR1E.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/48KB_TyyHR1E.jpg and /dev/null differ diff --git a/FusionIIIT/media/48KB_ezsXDVu.jpg b/FusionIIIT/media/48KB_ezsXDVu.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/48KB_ezsXDVu.jpg and /dev/null differ diff --git a/FusionIIIT/media/4KB.png b/FusionIIIT/media/4KB.png deleted file mode 100644 index 911f3ee02..000000000 Binary files a/FusionIIIT/media/4KB.png and /dev/null differ diff --git a/FusionIIIT/media/4KB_VuQkbvP.png b/FusionIIIT/media/4KB_VuQkbvP.png deleted file mode 100644 index 911f3ee02..000000000 Binary files a/FusionIIIT/media/4KB_VuQkbvP.png and /dev/null differ diff --git a/FusionIIIT/media/4KB_YKxdDGZ.png b/FusionIIIT/media/4KB_YKxdDGZ.png deleted file mode 100644 index 911f3ee02..000000000 Binary files a/FusionIIIT/media/4KB_YKxdDGZ.png and /dev/null differ diff --git a/FusionIIIT/media/564KB.png b/FusionIIIT/media/564KB.png deleted file mode 100644 index d475b5856..000000000 Binary files a/FusionIIIT/media/564KB.png and /dev/null differ diff --git a/FusionIIIT/media/564KB_tAorR6k.png b/FusionIIIT/media/564KB_tAorR6k.png deleted file mode 100644 index d475b5856..000000000 Binary files a/FusionIIIT/media/564KB_tAorR6k.png and /dev/null differ diff --git a/FusionIIIT/media/564KB_w8K2FLg.png b/FusionIIIT/media/564KB_w8K2FLg.png deleted file mode 100644 index d475b5856..000000000 Binary files a/FusionIIIT/media/564KB_w8K2FLg.png and /dev/null differ diff --git a/FusionIIIT/media/976KB.png b/FusionIIIT/media/976KB.png deleted file mode 100644 index 2c83209f4..000000000 Binary files a/FusionIIIT/media/976KB.png and /dev/null differ diff --git a/FusionIIIT/media/976KB_LsFRDHW.png b/FusionIIIT/media/976KB_LsFRDHW.png deleted file mode 100644 index 2c83209f4..000000000 Binary files a/FusionIIIT/media/976KB_LsFRDHW.png and /dev/null differ diff --git a/FusionIIIT/media/ASSIGNMENT.pdf b/FusionIIIT/media/ASSIGNMENT.pdf deleted file mode 100644 index 5f59b08c0..000000000 Binary files a/FusionIIIT/media/ASSIGNMENT.pdf and /dev/null differ diff --git a/FusionIIIT/media/ASSIGNMENT_M9FShVJ.pdf b/FusionIIIT/media/ASSIGNMENT_M9FShVJ.pdf deleted file mode 100644 index 5f59b08c0..000000000 Binary files a/FusionIIIT/media/ASSIGNMENT_M9FShVJ.pdf and /dev/null differ diff --git a/FusionIIIT/media/Administrator/academic_information/sheet.xlsx b/FusionIIIT/media/Administrator/academic_information/sheet.xlsx new file mode 100644 index 000000000..274ab022f Binary files /dev/null and b/FusionIIIT/media/Administrator/academic_information/sheet.xlsx differ diff --git a/FusionIIIT/media/Capture_832VvV6.PNG b/FusionIIIT/media/Capture_832VvV6.PNG deleted file mode 100644 index 9e858c70a..000000000 Binary files a/FusionIIIT/media/Capture_832VvV6.PNG and /dev/null differ diff --git a/FusionIIIT/media/Capture_NCxCLwL.PNG b/FusionIIIT/media/Capture_NCxCLwL.PNG deleted file mode 100644 index e9fc35e68..000000000 Binary files a/FusionIIIT/media/Capture_NCxCLwL.PNG and /dev/null differ diff --git a/FusionIIIT/media/Capture_TphWQy5.PNG b/FusionIIIT/media/Capture_TphWQy5.PNG deleted file mode 100644 index 9e858c70a..000000000 Binary files a/FusionIIIT/media/Capture_TphWQy5.PNG and /dev/null differ diff --git a/FusionIIIT/media/Capture_V7GzWgM.PNG b/FusionIIIT/media/Capture_V7GzWgM.PNG deleted file mode 100644 index 9e858c70a..000000000 Binary files a/FusionIIIT/media/Capture_V7GzWgM.PNG and /dev/null differ diff --git a/FusionIIIT/media/Capture_lHfdqEG.PNG b/FusionIIIT/media/Capture_lHfdqEG.PNG deleted file mode 100644 index 9e858c70a..000000000 Binary files a/FusionIIIT/media/Capture_lHfdqEG.PNG and /dev/null differ diff --git a/FusionIIIT/media/Capture_ofqjYvS.PNG b/FusionIIIT/media/Capture_ofqjYvS.PNG deleted file mode 100644 index 9e858c70a..000000000 Binary files a/FusionIIIT/media/Capture_ofqjYvS.PNG and /dev/null differ diff --git a/FusionIIIT/media/Chrysanthemum.jpg b/FusionIIIT/media/Chrysanthemum.jpg deleted file mode 100644 index 757c2a628..000000000 Binary files a/FusionIIIT/media/Chrysanthemum.jpg and /dev/null differ diff --git a/FusionIIIT/media/Chrysanthemum_KIrrQ5X.jpg b/FusionIIIT/media/Chrysanthemum_KIrrQ5X.jpg deleted file mode 100644 index 757c2a628..000000000 Binary files a/FusionIIIT/media/Chrysanthemum_KIrrQ5X.jpg and /dev/null differ diff --git a/FusionIIIT/media/Chrysanthemum_boupFDj.jpg b/FusionIIIT/media/Chrysanthemum_boupFDj.jpg deleted file mode 100644 index 757c2a628..000000000 Binary files a/FusionIIIT/media/Chrysanthemum_boupFDj.jpg and /dev/null differ diff --git a/FusionIIIT/media/Desert.jpg b/FusionIIIT/media/Desert.jpg deleted file mode 100644 index 0b88c9133..000000000 Binary files a/FusionIIIT/media/Desert.jpg and /dev/null differ diff --git a/FusionIIIT/media/Desert_H55mbwi.jpg b/FusionIIIT/media/Desert_H55mbwi.jpg deleted file mode 100644 index 0b88c9133..000000000 Binary files a/FusionIIIT/media/Desert_H55mbwi.jpg and /dev/null differ diff --git a/FusionIIIT/media/Desert_sMVqJfr.jpg b/FusionIIIT/media/Desert_sMVqJfr.jpg deleted file mode 100644 index 0b88c9133..000000000 Binary files a/FusionIIIT/media/Desert_sMVqJfr.jpg and /dev/null differ diff --git a/FusionIIIT/media/IMG-20180914-WA0001.jpg b/FusionIIIT/media/IMG-20180914-WA0001.jpg deleted file mode 100644 index 8867752da..000000000 Binary files a/FusionIIIT/media/IMG-20180914-WA0001.jpg and /dev/null differ diff --git a/FusionIIIT/media/IP_Project_Brain_Haemorrhage.pdf b/FusionIIIT/media/IP_Project_Brain_Haemorrhage.pdf deleted file mode 100644 index 5af26ab52..000000000 Binary files a/FusionIIIT/media/IP_Project_Brain_Haemorrhage.pdf and /dev/null differ diff --git a/FusionIIIT/media/IP_Project_Brain_Haemorrhage_9XhG25i.pdf b/FusionIIIT/media/IP_Project_Brain_Haemorrhage_9XhG25i.pdf deleted file mode 100644 index 5af26ab52..000000000 Binary files a/FusionIIIT/media/IP_Project_Brain_Haemorrhage_9XhG25i.pdf and /dev/null differ diff --git a/FusionIIIT/media/Lighthouse_2MzJMjV.jpg b/FusionIIIT/media/Lighthouse_2MzJMjV.jpg deleted file mode 100644 index 494be09b8..000000000 Binary files a/FusionIIIT/media/Lighthouse_2MzJMjV.jpg and /dev/null differ diff --git a/FusionIIIT/media/Lighthouse_asJUMg0.jpg b/FusionIIIT/media/Lighthouse_asJUMg0.jpg deleted file mode 100644 index 494be09b8..000000000 Binary files a/FusionIIIT/media/Lighthouse_asJUMg0.jpg and /dev/null differ diff --git a/FusionIIIT/media/Lighthouse_k8vR5gc.jpg b/FusionIIIT/media/Lighthouse_k8vR5gc.jpg deleted file mode 100644 index 494be09b8..000000000 Binary files a/FusionIIIT/media/Lighthouse_k8vR5gc.jpg and /dev/null differ diff --git a/FusionIIIT/media/Lighthouse_kv2ONOy.jpg b/FusionIIIT/media/Lighthouse_kv2ONOy.jpg deleted file mode 100644 index 494be09b8..000000000 Binary files a/FusionIIIT/media/Lighthouse_kv2ONOy.jpg and /dev/null differ diff --git a/FusionIIIT/media/New_Text_Document_2_wgRF9M5.txt b/FusionIIIT/media/New_Text_Document_2_wgRF9M5.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/FusionIIIT/media/Parivartan_Desktop.jpg b/FusionIIIT/media/Parivartan_Desktop.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop.jpg and /dev/null differ diff --git a/FusionIIIT/media/Parivartan_Desktop_2AZxa7A.jpg b/FusionIIIT/media/Parivartan_Desktop_2AZxa7A.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop_2AZxa7A.jpg and /dev/null differ diff --git a/FusionIIIT/media/Parivartan_Desktop_A3za29C.jpg b/FusionIIIT/media/Parivartan_Desktop_A3za29C.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop_A3za29C.jpg and /dev/null differ diff --git a/FusionIIIT/media/Parivartan_Desktop_D3gcCwQ.jpg b/FusionIIIT/media/Parivartan_Desktop_D3gcCwQ.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop_D3gcCwQ.jpg and /dev/null differ diff --git a/FusionIIIT/media/Parivartan_Desktop_WObTsJy.jpg b/FusionIIIT/media/Parivartan_Desktop_WObTsJy.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop_WObTsJy.jpg and /dev/null differ diff --git a/FusionIIIT/media/Parivartan_Desktop_pucd5dp.jpg b/FusionIIIT/media/Parivartan_Desktop_pucd5dp.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop_pucd5dp.jpg and /dev/null differ diff --git a/FusionIIIT/media/Parivartan_Desktop_sQh5sCr.jpg b/FusionIIIT/media/Parivartan_Desktop_sQh5sCr.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop_sQh5sCr.jpg and /dev/null differ diff --git a/FusionIIIT/media/R19BZ0dfQ1NDNF9QUk9EX0FQLlxBUFxQUk9EXEdvVG9NeURlc2t0b3AyMFxHb1RvTXlEZXNrdG9wMg--.ica b/FusionIIIT/media/R19BZ0dfQ1NDNF9QUk9EX0FQLlxBUFxQUk9EXEdvVG9NeURlc2t0b3AyMFxHb1RvTXlEZXNrdG9wMg--.ica deleted file mode 100644 index 91a31a332..000000000 --- a/FusionIIIT/media/R19BZ0dfQ1NDNF9QUk9EX0FQLlxBUFxQUk9EXEdvVG9NeURlc2t0b3AyMFxHb1RvTXlEZXNrdG9wMg--.ica +++ /dev/null @@ -1,76 +0,0 @@ -[Encoding] -InputEncoding=UTF8 - -[WFClient] -CDMAllowed=False -CLIPBOARDALLOWED=False -ProxyFavorIEConnectionSetting=Yes -ProxyTimeout=30000 -ProxyType=Auto -ProxyUseFQDN=Off -RemoveICAFile=yes -TransparentKeyPassthrough=Local -TransportReconnectEnabled=Off -Version=2 -VirtualCOMPortEmulation=On - -[ApplicationServers] -XA0008_GoToMyDeskto= - -[XA0008_GoToMyDeskto] -Address=;40;STA847546794;875677C91ECA49699902808E05782B -AutologonAllowed=On -BrowserProtocol=HTTPonTCP -CGPSecurityTicket=On -ClientAudio=On -DesiredColor=8 -DesiredHRES=0 -DesiredVRES=0 -DisableCtrlAltDel=Off -DoNotUseDefaultCSL=On -FontSmoothingType=0 -HDXoverUDP=Off -HTTPBrowserAddress=! -InitialProgram=#XA0008_GoToMyDeskto -Launcher=WI -LaunchReference=2FCB7AABF5E0F23777A748B167C751 -LocHttpBrowserAddress=! -LongCommandLine= -LPWD=235 -NRWD=151 -ProxyTimeout=30000 -ProxyType=Auto -SecureChannelProtocol=Detect -SessionsharingKey=KzQ0nZ+F/Kvu3YOEOdLNqmFKhdt8KyOz -SFRAllowed=Off -SSLCiphers=all -SSLEnable=On -SSLProxyHost=mydesk-ap-r.credit-suisse.com:443 -startSCD=1591082680062 -Title=GoToMyDesktop2 -TransportDriver=TCP/IP -TRWD=0 -TWIMode=On -UseLocalUserAndPassword=On -WinStationDriver=ICA 3.0 - -[Compress] -DriverNameWin16=pdcompw.dll -DriverNameWin32=pdcompn.dll - -[EncRC5-0] -DriverNameWin16=pdc0w.dll -DriverNameWin32=pdc0n.dll - -[EncRC5-128] -DriverNameWin16=pdc128w.dll -DriverNameWin32=pdc128n.dll - -[EncRC5-40] -DriverNameWin16=pdc40w.dll -DriverNameWin32=pdc40n.dll - -[EncRC5-56] -DriverNameWin16=pdc56w.dll -DriverNameWin32=pdc56n.dll - diff --git a/FusionIIIT/media/SFTBR-04.PDF b/FusionIIIT/media/SFTBR-04.PDF deleted file mode 100644 index af7279bbb..000000000 Binary files a/FusionIIIT/media/SFTBR-04.PDF and /dev/null differ diff --git a/FusionIIIT/media/SamplePNGImage_500kbmb.png b/FusionIIIT/media/SamplePNGImage_500kbmb.png deleted file mode 100644 index b374d33c1..000000000 --- a/FusionIIIT/media/SamplePNGImage_500kbmb.png +++ /dev/null @@ -1,1122 +0,0 @@ - - - Download Sample Videos / Dummy Videos For Demo Use - - - - - - - - - - - - - - - - - -
- - -
-
- - - -
-
-
-
- -
- - -
- -
- - -
- -
-
-
- - - -
- -

Download Sample Videos

- -

Are you a mobile app developer?

-

Are you looking for videos of different resolution and sizes to test while designing or developing a mobile app?

-

Sample-Videos.com is a 100% FREE service that allows programmers, testers, designers, developers to download sample videos for demo/test use. No matter what video format they use (MP4, FLV, MKV, 3GP); they will be able to test videos on any Smartphone without any hustle. This is a one stop destination for all sample video testing needs. Just search below for the relevant video formats in specific sizes, download them, and start testing.

-

A mobile screen resolution can be a big challenge when it comes to watching videos online or offline. By testing out videos one can be rest assured regarding the video playback in an app, without annoying the end users. Choose from four different video extensions i.e. 3GP, MKV, FLV, and MP4. The best thing is all of these are free and very easy to download. We provide you with a specific and perfect resolution in all sizes possible with just one simple click. Check out the one which suits your requirements. All you need to do is hit the DOWNLOAD button, and get started.

- - -
-

Download .mp4 Sample Video

- -
- - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
1mp41280x720Click
2mp41280x720Click
5mp41280x720Click
10mp41280x720Click
- - - -
20mp41280x720Click
30mp41280x720Click
1mp4720x480Click
2mp4720x480Click
5mp4720x480Click
10mp4720x480Click
20mp4720x480Click
30mp4720x480Click
1mp4640x360Click
2mp4640x360Click
5mp4640x360Click
10mp4640x360Click
20mp4640x360Click
30mp4640x360Click
1mp4360x240Click
2mp4360x240Click
5mp4360x240Click
10mp4360x240Click
20mp4360x240Click
30mp4360x240Click
- -
- -
-
- -

Download .flv Sample Video

-
- - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
1flv1280x720Click
2flv1280x720Click
5flv1280x720Click
10flv1280x720Click
- - - -
20flv1280x720Click
30flv1280x720Click
1flv720x480Click
2flv720x480Click
5flv720x480Click
10flv720x480Click
20flv720x480Click
30flv720x480Click
1flv640x360Click
2flv640x360Click
5flv640x360Click
10flv640x360Click
20flv640x360Click
30flv640x360Click
1flv360x240Click
2flv360x240Click
5flv360x240Click
10flv360x240Click
20flv360x240Click
30flv360x240Click
-
- -
-
- -

Download .mkv Sample Video

-
- - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
1mkv1280x720Click
2mkv1280x720Click
5mkv1280x720Click
10mkv1280x720Click
- - - -
20mkv1280x720Click
30mkv1280x720Click
1mkv720x480Click
2mkv720x480Click
5mkv720x480Click
10mkv720x480Click
20mkv720x480Click
30mkv720x480Click
1mkv640x360Click
2mkv640x360Click
5mkv640x360Click
10mkv640x360Click
20mkv640x360Click
30mkv640x360Click
1mkv360x240Click
2mkv360x240Click
5mkv360x240Click
10mkv360x240Click
20mkv360x240Click
30mkv360x240Click
- -
- -
-
- -

Download .3gp Sample Video

-
- - - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
13gp176x144Click
23gp176x144Click
53gp176x144Click
103gp176x144Click
- - - -
13gp320x240Click
23gp320x240Click
53gp320x240Click
103gp320x240Click
203gp320x240Click
303gp320x240Click
- -
- -
- - - - -
- - -
-
- - - - - -
-
- -
-
-
- -
-
- -
-
-
- -
-
- -
-
- - - -
- -
- -
- - - - - - - -
- - - - -
- - -
- -
- - -
- - - - - - - - - - - - - -
-
- © Sample Video Developers - www.bigbuckbunny.org -
-
- - - - - - - - - - - - - - - - - - - - - -
- - diff --git a/FusionIIIT/media/SamplePNGImage_500kbmb_0BkXR0Y.png b/FusionIIIT/media/SamplePNGImage_500kbmb_0BkXR0Y.png deleted file mode 100644 index b374d33c1..000000000 --- a/FusionIIIT/media/SamplePNGImage_500kbmb_0BkXR0Y.png +++ /dev/null @@ -1,1122 +0,0 @@ - - - Download Sample Videos / Dummy Videos For Demo Use - - - - - - - - - - - - - - - - - -
- - -
-
- - - -
-
-
-
- -
- - -
- -
- - -
- -
-
-
- - - -
- -

Download Sample Videos

- -

Are you a mobile app developer?

-

Are you looking for videos of different resolution and sizes to test while designing or developing a mobile app?

-

Sample-Videos.com is a 100% FREE service that allows programmers, testers, designers, developers to download sample videos for demo/test use. No matter what video format they use (MP4, FLV, MKV, 3GP); they will be able to test videos on any Smartphone without any hustle. This is a one stop destination for all sample video testing needs. Just search below for the relevant video formats in specific sizes, download them, and start testing.

-

A mobile screen resolution can be a big challenge when it comes to watching videos online or offline. By testing out videos one can be rest assured regarding the video playback in an app, without annoying the end users. Choose from four different video extensions i.e. 3GP, MKV, FLV, and MP4. The best thing is all of these are free and very easy to download. We provide you with a specific and perfect resolution in all sizes possible with just one simple click. Check out the one which suits your requirements. All you need to do is hit the DOWNLOAD button, and get started.

- - -
-

Download .mp4 Sample Video

- -
- - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
1mp41280x720Click
2mp41280x720Click
5mp41280x720Click
10mp41280x720Click
- - - -
20mp41280x720Click
30mp41280x720Click
1mp4720x480Click
2mp4720x480Click
5mp4720x480Click
10mp4720x480Click
20mp4720x480Click
30mp4720x480Click
1mp4640x360Click
2mp4640x360Click
5mp4640x360Click
10mp4640x360Click
20mp4640x360Click
30mp4640x360Click
1mp4360x240Click
2mp4360x240Click
5mp4360x240Click
10mp4360x240Click
20mp4360x240Click
30mp4360x240Click
- -
- -
-
- -

Download .flv Sample Video

-
- - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
1flv1280x720Click
2flv1280x720Click
5flv1280x720Click
10flv1280x720Click
- - - -
20flv1280x720Click
30flv1280x720Click
1flv720x480Click
2flv720x480Click
5flv720x480Click
10flv720x480Click
20flv720x480Click
30flv720x480Click
1flv640x360Click
2flv640x360Click
5flv640x360Click
10flv640x360Click
20flv640x360Click
30flv640x360Click
1flv360x240Click
2flv360x240Click
5flv360x240Click
10flv360x240Click
20flv360x240Click
30flv360x240Click
-
- -
-
- -

Download .mkv Sample Video

-
- - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
1mkv1280x720Click
2mkv1280x720Click
5mkv1280x720Click
10mkv1280x720Click
- - - -
20mkv1280x720Click
30mkv1280x720Click
1mkv720x480Click
2mkv720x480Click
5mkv720x480Click
10mkv720x480Click
20mkv720x480Click
30mkv720x480Click
1mkv640x360Click
2mkv640x360Click
5mkv640x360Click
10mkv640x360Click
20mkv640x360Click
30mkv640x360Click
1mkv360x240Click
2mkv360x240Click
5mkv360x240Click
10mkv360x240Click
20mkv360x240Click
30mkv360x240Click
- -
- -
-
- -

Download .3gp Sample Video

-
- - - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
13gp176x144Click
23gp176x144Click
53gp176x144Click
103gp176x144Click
- - - -
13gp320x240Click
23gp320x240Click
53gp320x240Click
103gp320x240Click
203gp320x240Click
303gp320x240Click
- -
- -
- - - - -
- - -
-
- - - - - -
-
- -
-
-
- -
-
- -
-
-
- -
-
- -
-
- - - -
- -
- -
- - - - - - - -
- - - - -
- - -
- -
- - -
- - - - - - - - - - - - - -
-
- © Sample Video Developers - www.bigbuckbunny.org -
-
- - - - - - - - - - - - - - - - - - - - - -
- - diff --git a/FusionIIIT/media/Screenshot_1.png b/FusionIIIT/media/Screenshot_1.png deleted file mode 100644 index 03aed985d..000000000 Binary files a/FusionIIIT/media/Screenshot_1.png and /dev/null differ diff --git a/FusionIIIT/media/Screenshot_1_ZRkbwbZ.png b/FusionIIIT/media/Screenshot_1_ZRkbwbZ.png deleted file mode 100644 index 03aed985d..000000000 Binary files a/FusionIIIT/media/Screenshot_1_ZRkbwbZ.png and /dev/null differ diff --git a/FusionIIIT/media/Screenshot_2020-07-01_CBIR_Using_Color_Difference_Histogram_-_Retrieval_-_Jupyter_Notebook.png b/FusionIIIT/media/Screenshot_2020-07-01_CBIR_Using_Color_Difference_Histogram_-_Retrieval_-_Jupyter_Notebook.png deleted file mode 100644 index 80bfcf678..000000000 Binary files a/FusionIIIT/media/Screenshot_2020-07-01_CBIR_Using_Color_Difference_Histogram_-_Retrieval_-_Jupyter_Notebook.png and /dev/null differ diff --git a/FusionIIIT/media/Solution.jpeg b/FusionIIIT/media/Solution.jpeg deleted file mode 100644 index c4467fe4b..000000000 Binary files a/FusionIIIT/media/Solution.jpeg and /dev/null differ diff --git a/FusionIIIT/media/a1.PNG b/FusionIIIT/media/a1.PNG deleted file mode 100644 index 1d1e6039d..000000000 Binary files a/FusionIIIT/media/a1.PNG and /dev/null differ diff --git a/FusionIIIT/media/ajju.pdf b/FusionIIIT/media/ajju.pdf deleted file mode 100644 index 8c794c0a0..000000000 Binary files a/FusionIIIT/media/ajju.pdf and /dev/null differ diff --git a/FusionIIIT/media/ajju_ipTPZnA.pdf b/FusionIIIT/media/ajju_ipTPZnA.pdf deleted file mode 100644 index 8c794c0a0..000000000 Binary files a/FusionIIIT/media/ajju_ipTPZnA.pdf and /dev/null differ diff --git a/FusionIIIT/media/allane.pdf b/FusionIIIT/media/allane.pdf deleted file mode 100644 index aea95724d..000000000 Binary files a/FusionIIIT/media/allane.pdf and /dev/null differ diff --git a/FusionIIIT/media/allane_mqBZZDj.pdf b/FusionIIIT/media/allane_mqBZZDj.pdf deleted file mode 100644 index aea95724d..000000000 Binary files a/FusionIIIT/media/allane_mqBZZDj.pdf and /dev/null differ diff --git a/FusionIIIT/media/bonafide.pdf b/FusionIIIT/media/bonafide.pdf deleted file mode 100644 index 9469632b6..000000000 Binary files a/FusionIIIT/media/bonafide.pdf and /dev/null differ diff --git a/FusionIIIT/media/bonafide_3p6qeQY.pdf b/FusionIIIT/media/bonafide_3p6qeQY.pdf deleted file mode 100644 index 9469632b6..000000000 Binary files a/FusionIIIT/media/bonafide_3p6qeQY.pdf and /dev/null differ diff --git a/FusionIIIT/media/bonafide_W7s1Auu.pdf b/FusionIIIT/media/bonafide_W7s1Auu.pdf deleted file mode 100644 index 9469632b6..000000000 Binary files a/FusionIIIT/media/bonafide_W7s1Auu.pdf and /dev/null differ diff --git a/FusionIIIT/media/bonafide_b25Y6TV.pdf b/FusionIIIT/media/bonafide_b25Y6TV.pdf deleted file mode 100644 index 9469632b6..000000000 Binary files a/FusionIIIT/media/bonafide_b25Y6TV.pdf and /dev/null differ diff --git a/FusionIIIT/media/demo.zip b/FusionIIIT/media/demo.zip deleted file mode 100644 index 15cb0ecb3..000000000 Binary files a/FusionIIIT/media/demo.zip and /dev/null differ diff --git a/FusionIIIT/media/demo_0SCeEho.zip b/FusionIIIT/media/demo_0SCeEho.zip deleted file mode 100644 index 15cb0ecb3..000000000 Binary files a/FusionIIIT/media/demo_0SCeEho.zip and /dev/null differ diff --git a/FusionIIIT/media/demo_Ecf0ATC.zip b/FusionIIIT/media/demo_Ecf0ATC.zip deleted file mode 100644 index 15cb0ecb3..000000000 Binary files a/FusionIIIT/media/demo_Ecf0ATC.zip and /dev/null differ diff --git a/FusionIIIT/media/demo_uqf8R7p.zip b/FusionIIIT/media/demo_uqf8R7p.zip deleted file mode 100644 index 15cb0ecb3..000000000 Binary files a/FusionIIIT/media/demo_uqf8R7p.zip and /dev/null differ diff --git a/FusionIIIT/media/documents/wrist_band.jpg b/FusionIIIT/media/documents/wrist_band.jpg deleted file mode 100644 index abbbdceda..000000000 Binary files a/FusionIIIT/media/documents/wrist_band.jpg and /dev/null differ diff --git a/FusionIIIT/media/event.jpg b/FusionIIIT/media/event.jpg deleted file mode 100644 index bb88b387b..000000000 Binary files a/FusionIIIT/media/event.jpg and /dev/null differ diff --git a/FusionIIIT/media/event.pdf b/FusionIIIT/media/event.pdf deleted file mode 100644 index b92477282..000000000 Binary files a/FusionIIIT/media/event.pdf and /dev/null differ diff --git a/FusionIIIT/media/event_n6JOVni.pdf b/FusionIIIT/media/event_n6JOVni.pdf deleted file mode 100644 index b92477282..000000000 Binary files a/FusionIIIT/media/event_n6JOVni.pdf and /dev/null differ diff --git a/FusionIIIT/media/image.jpg b/FusionIIIT/media/image.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_007RJnp.jpg b/FusionIIIT/media/image_007RJnp.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_007RJnp.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_08EzmEH.jpg b/FusionIIIT/media/image_08EzmEH.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_08EzmEH.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_6xkgtat.jpg b/FusionIIIT/media/image_6xkgtat.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_6xkgtat.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_8Al2hkC.jpg b/FusionIIIT/media/image_8Al2hkC.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_8Al2hkC.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_DArY4kM.jpg b/FusionIIIT/media/image_DArY4kM.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_DArY4kM.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Dj9wBVK.jpg b/FusionIIIT/media/image_Dj9wBVK.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Dj9wBVK.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_DnBzrXz.jpg b/FusionIIIT/media/image_DnBzrXz.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_DnBzrXz.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_EHN0uUR.jpg b/FusionIIIT/media/image_EHN0uUR.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_EHN0uUR.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_ERAUsuR.jpg b/FusionIIIT/media/image_ERAUsuR.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_ERAUsuR.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_FCiEnEA.jpg b/FusionIIIT/media/image_FCiEnEA.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_FCiEnEA.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_GDxnCEC.jpg b/FusionIIIT/media/image_GDxnCEC.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_GDxnCEC.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Gt3KGJq.jpg b/FusionIIIT/media/image_Gt3KGJq.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Gt3KGJq.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Gt3KGJq_bdxtRTW.jpg b/FusionIIIT/media/image_Gt3KGJq_bdxtRTW.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Gt3KGJq_bdxtRTW.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Gt3KGJq_rXplFd4.jpg b/FusionIIIT/media/image_Gt3KGJq_rXplFd4.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Gt3KGJq_rXplFd4.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Gt3KGJq_sTQs693.jpg b/FusionIIIT/media/image_Gt3KGJq_sTQs693.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Gt3KGJq_sTQs693.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_IsZTv03.jpg b/FusionIIIT/media/image_IsZTv03.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_IsZTv03.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_LUkx8md.jpg b/FusionIIIT/media/image_LUkx8md.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_LUkx8md.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_OFiO2Bh.jpg b/FusionIIIT/media/image_OFiO2Bh.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_OFiO2Bh.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_OLuWcRU.jpg b/FusionIIIT/media/image_OLuWcRU.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_OLuWcRU.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Onw3X55.jpg b/FusionIIIT/media/image_Onw3X55.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Onw3X55.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_SGKG9Zh.jpg b/FusionIIIT/media/image_SGKG9Zh.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_SGKG9Zh.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_UiGJa1M.jpg b/FusionIIIT/media/image_UiGJa1M.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_UiGJa1M.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_VAHo0g5.jpg b/FusionIIIT/media/image_VAHo0g5.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_VAHo0g5.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Z5HxbWe.jpg b/FusionIIIT/media/image_Z5HxbWe.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Z5HxbWe.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_ZHDevJQ.jpg b/FusionIIIT/media/image_ZHDevJQ.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_ZHDevJQ.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_behus5I.jpg b/FusionIIIT/media/image_behus5I.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_behus5I.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_iBr1k6y.jpg b/FusionIIIT/media/image_iBr1k6y.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_iBr1k6y.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_kKfwblf.jpg b/FusionIIIT/media/image_kKfwblf.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_kKfwblf.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_nJznh8V.jpg b/FusionIIIT/media/image_nJznh8V.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_nJznh8V.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_nbHQErT.jpg b/FusionIIIT/media/image_nbHQErT.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_nbHQErT.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_qsbU8zn.jpg b/FusionIIIT/media/image_qsbU8zn.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_qsbU8zn.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_r9niVQQ.jpg b/FusionIIIT/media/image_r9niVQQ.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_r9niVQQ.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_vanCtHs.jpg b/FusionIIIT/media/image_vanCtHs.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_vanCtHs.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_xStQjYa.jpg b/FusionIIIT/media/image_xStQjYa.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_xStQjYa.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_xZWkinz.jpg b/FusionIIIT/media/image_xZWkinz.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_xZWkinz.jpg and /dev/null differ diff --git a/FusionIIIT/media/mj.png b/FusionIIIT/media/mj.png deleted file mode 100644 index 4a086b80a..000000000 Binary files a/FusionIIIT/media/mj.png and /dev/null differ diff --git a/FusionIIIT/media/mj_Al5ccBb.png b/FusionIIIT/media/mj_Al5ccBb.png deleted file mode 100644 index 4a086b80a..000000000 Binary files a/FusionIIIT/media/mj_Al5ccBb.png and /dev/null differ diff --git a/FusionIIIT/media/mj_J3NIY2c.png b/FusionIIIT/media/mj_J3NIY2c.png deleted file mode 100644 index 4a086b80a..000000000 Binary files a/FusionIIIT/media/mj_J3NIY2c.png and /dev/null differ diff --git a/FusionIIIT/media/mj_NfL2mTM.png b/FusionIIIT/media/mj_NfL2mTM.png deleted file mode 100644 index 4a086b80a..000000000 Binary files a/FusionIIIT/media/mj_NfL2mTM.png and /dev/null differ diff --git a/FusionIIIT/media/mj_ZImWkc8.png b/FusionIIIT/media/mj_ZImWkc8.png deleted file mode 100644 index 4a086b80a..000000000 Binary files a/FusionIIIT/media/mj_ZImWkc8.png and /dev/null differ diff --git a/FusionIIIT/media/mmmm.png b/FusionIIIT/media/mmmm.png deleted file mode 100644 index 52a802bb0..000000000 Binary files a/FusionIIIT/media/mmmm.png and /dev/null differ diff --git a/FusionIIIT/media/mmmm_dFrFt7K.png b/FusionIIIT/media/mmmm_dFrFt7K.png deleted file mode 100644 index 52a802bb0..000000000 Binary files a/FusionIIIT/media/mmmm_dFrFt7K.png and /dev/null differ diff --git a/FusionIIIT/media/output-onlinepngtools_5.png b/FusionIIIT/media/output-onlinepngtools_5.png deleted file mode 100644 index 782551f21..000000000 Binary files a/FusionIIIT/media/output-onlinepngtools_5.png and /dev/null differ diff --git a/FusionIIIT/media/output-onlinepngtools_5_47NIAdi.png b/FusionIIIT/media/output-onlinepngtools_5_47NIAdi.png deleted file mode 100644 index 782551f21..000000000 Binary files a/FusionIIIT/media/output-onlinepngtools_5_47NIAdi.png and /dev/null differ diff --git a/FusionIIIT/media/output-onlinepngtools_5_ZAOVWvi.png b/FusionIIIT/media/output-onlinepngtools_5_ZAOVWvi.png deleted file mode 100644 index 782551f21..000000000 Binary files a/FusionIIIT/media/output-onlinepngtools_5_ZAOVWvi.png and /dev/null differ diff --git a/FusionIIIT/media/photo-1480365501497-199581be0e66.jpg b/FusionIIIT/media/photo-1480365501497-199581be0e66.jpg deleted file mode 100644 index 55c4b20bc..000000000 Binary files a/FusionIIIT/media/photo-1480365501497-199581be0e66.jpg and /dev/null differ diff --git a/FusionIIIT/media/sample.jpg b/FusionIIIT/media/sample.jpg deleted file mode 100644 index 0a18df12f..000000000 Binary files a/FusionIIIT/media/sample.jpg and /dev/null differ diff --git a/FusionIIIT/media/sample_a2In3HQ.jpg b/FusionIIIT/media/sample_a2In3HQ.jpg deleted file mode 100644 index 0a18df12f..000000000 Binary files a/FusionIIIT/media/sample_a2In3HQ.jpg and /dev/null differ diff --git a/FusionIIIT/media/sample_maFMAz9.jpg b/FusionIIIT/media/sample_maFMAz9.jpg deleted file mode 100644 index 0a18df12f..000000000 Binary files a/FusionIIIT/media/sample_maFMAz9.jpg and /dev/null differ diff --git a/FusionIIIT/media/window.png b/FusionIIIT/media/window.png deleted file mode 100644 index 4ddc642a5..000000000 Binary files a/FusionIIIT/media/window.png and /dev/null differ diff --git a/FusionIIIT/media/window_QaSCiCB.png b/FusionIIIT/media/window_QaSCiCB.png deleted file mode 100644 index 4ddc642a5..000000000 Binary files a/FusionIIIT/media/window_QaSCiCB.png and /dev/null differ diff --git a/FusionIIIT/media/wrist_band.jpg b/FusionIIIT/media/wrist_band.jpg deleted file mode 100644 index abbbdceda..000000000 Binary files a/FusionIIIT/media/wrist_band.jpg and /dev/null differ diff --git a/FusionIIIT/media/wrist_band_104sJ7l.jpg b/FusionIIIT/media/wrist_band_104sJ7l.jpg deleted file mode 100644 index abbbdceda..000000000 Binary files a/FusionIIIT/media/wrist_band_104sJ7l.jpg and /dev/null differ diff --git a/FusionIIIT/templates/academic_procedures/academic.html b/FusionIIIT/templates/academic_procedures/academic.html index 35eebf446..90b518b0b 100644 --- a/FusionIIIT/templates/academic_procedures/academic.html +++ b/FusionIIIT/templates/academic_procedures/academic.html @@ -183,10 +183,10 @@ {% include 'academic_procedures/registeredCourse.html' %}
- {% include 'academic_procedures/register.html' %} + {% include 'academic_procedures/auto_pre_registration.html' %}
- {% include 'academic_procedures/finalregister.html' %} + {% include 'academic_procedures/auto_finalregister.html' %}
@@ -204,7 +204,12 @@ Add/drop courses - + + Backlogs + + + Replace +
- +
+ {% include 'academic_procedures/backlog.html' %} +
+
+ {% include 'academic_procedures/replace.html' %} +
diff --git a/FusionIIIT/templates/academic_procedures/academicfac.html b/FusionIIIT/templates/academic_procedures/academicfac.html index dd74efff5..db08757d7 100644 --- a/FusionIIIT/templates/academic_procedures/academicfac.html +++ b/FusionIIIT/templates/academic_procedures/academicfac.html @@ -25,7 +25,13 @@ style="max-width: 320px;"> {% if fac_flag %} - + {% if request.user.extrainfo.user_type == 'fx' or request.user.extrainfo.user_type == 'faculty' %} + + Assigned Course + + + {% endif %} + Course Management @@ -61,9 +67,60 @@ Kartik {% endcomment %} +
+
+
+ + + + + + + + + + + + + + + + + + + + {% for course in assigned_courses %} + + + + + + + + + + + + + {%endfor%} + +

Course Name

Course Code

Course Version

Programme

Branch

Year

Download Roll List

{{course.course_id.name }} {{course.course_id.code }} {{course.course_id.version }} {{course.batch_id.name }} {{course.batch_id.discipline.name }} {{course.batch_id.year }} +
+ {% csrf_token %} + + + +
+
+
+
+
-
+


@@ -78,7 +135,7 @@ - + diff --git a/FusionIIIT/templates/academic_procedures/studentSwayam.html b/FusionIIIT/templates/academic_procedures/studentSwayam.html new file mode 100644 index 000000000..6a912f3e9 --- /dev/null +++ b/FusionIIIT/templates/academic_procedures/studentSwayam.html @@ -0,0 +1,322 @@ +{% load static %} + + + + +
+
+ {% if dict2 %} + +           +           +           +           + Name = {{ dict2.firstname }} {{ dict2.lastname }} +           +           +           + Roll No = {{ dict2.roll_no }} + + {% endif %} + {% if details %} +
{{obj.course_id.code}} {{obj.course_id.name}}{{ obj.batch_id }}{{ obj.batch_id.name}} {{obj.batch_id.year}}-{{obj.batch_id.discipline.name}} {% if adc_date_flag %} - {% if details.cpi >= 6.0 %} + {% if details.cpi >= 0.0 %} {% if add_courses_options %}
{% csrf_token %} diff --git a/FusionIIIT/templates/academic_procedures/allot_courses.html b/FusionIIIT/templates/academic_procedures/allot_courses.html index 5d4fc0e45..f5ac54c7e 100644 --- a/FusionIIIT/templates/academic_procedures/allot_courses.html +++ b/FusionIIIT/templates/academic_procedures/allot_courses.html @@ -27,7 +27,7 @@

diff --git a/FusionIIIT/templates/academic_procedures/auto_finalregister.html b/FusionIIIT/templates/academic_procedures/auto_finalregister.html new file mode 100644 index 000000000..95788c24d --- /dev/null +++ b/FusionIIIT/templates/academic_procedures/auto_finalregister.html @@ -0,0 +1,251 @@ +{% load static %} +{% block finalregister %} + + + + +
Final Registration
+ +
+ {% if curr_sem.semester_no != 8 %} + {% if frd %} + {% if final_registration_flag == True %} +

+

You have already registered for this semester!!!
+

+ + + {% else %} +
+ + {% csrf_token %} +
+ + + + + +
+ +
+
+ + +
+
+ +
+
+
+ + +
+ +
+ +
+
+ +
+
+
+ + +
+
+ + +
+
+
+ + +
+ +
+
+ + +
+
+
+
+
+
+
+ + + +
+
+ +
+
+ +
+ +
+ + + {% comment %}
+ {% csrf_token %} + +

Fee Payment

+ + + + + +
{% endcomment %} + {% endif %} + {% else %} +
+

Final Registration Date is yet to come

+
+ {% endif %} + {% else %} +
+

You are not Eligible for Registration !!

+
+ {% endif %} +
+{% endblock %} + + + + + + + + \ No newline at end of file diff --git a/FusionIIIT/templates/academic_procedures/auto_pre_registration.html b/FusionIIIT/templates/academic_procedures/auto_pre_registration.html new file mode 100644 index 000000000..b9129ca23 --- /dev/null +++ b/FusionIIIT/templates/academic_procedures/auto_pre_registration.html @@ -0,0 +1,437 @@ + + + + +{% load static %} +{% block resiterstudent %} + + +
Pre-Registration for Next Semester Courses
+
+ {% if curr_sem.semester_no != 8 %} + {% if prd %} + {% if pre_registration_flag %} + +
You have already registered at + {% if pre_registration_timestamp is not None %} + {{pre_registration_timestamp}} + {% endif %} + !!! +
+
View Courses
+
Hide courses
+
+
+
+ + + + + + + + + + + + {% for course_slot,courses in pre_registered_course_show.items %} + + + + + + + + + + {% endfor %} + + +
+
+
+ {% else %} +
+ {% csrf_token %} + + + + + + + + + + + + + + + {% for course_slot in next_sem_registration_courses %} + {% if course_slot.type == "Swayam" %} + {% with "x"|ljust:swayam_courses_count as dummy_range %} + {% for _ in dummy_range %} + + + + + + + + + + + {% endfor %} + {% endwith %} + {% else %} + + + + + + + + + + + + + {% endif %} + {% endfor %} + + + + +
#Slot nameSlot typeSemesterCreditsSelect
{{ forloop.counter0|add:forloop.parentloop.counter0|add:"+1" }}.{{course_slot.name}}{{course_slot.type}}{{next_sem.semester_no}} + + {{course_slot.courses.all.0.credit}} +
+ +
+
{{forloop.counter}}.{{course_slot.name}}{{course_slot.type}}{{next_sem.semester_no}} + + {{course_slot.courses.all.0.credit}} +
+ +
+
+
+
+ +
+
+
+ +
+
+
+

You need minimum {{curr_sem.curriculum.min_credit}} credits for semester {{next_sem.semester_no}}

+
+ + {% endif %} + {% else %} + {% if prd_start_date%} + +
Pre Registration will start on {{prd_start_date}}. +
+ {% else %} + +
Pre Registration date hasn't come yet +
+ {% endif %} + {% endif %} + {% else %} +
+

You are not Eligible for Registration !!

+
+ {% endif %} + +
+ + + +{% endblock %} + + + + diff --git a/FusionIIIT/templates/academic_procedures/backlog.html b/FusionIIIT/templates/academic_procedures/backlog.html new file mode 100644 index 000000000..e8e7253a5 --- /dev/null +++ b/FusionIIIT/templates/academic_procedures/backlog.html @@ -0,0 +1,21 @@ +{% load static %} +
Backlog Courses
+
+ + + + + + + + + + {% for i in backlogCourseList %} + + {% for j in i %} + + {% endfor %} + + {% endfor %} +
Course NameFacultySemester IDAvailable Summer Course
{{ j }}
+
\ No newline at end of file diff --git a/FusionIIIT/templates/academic_procedures/finalregister.html b/FusionIIIT/templates/academic_procedures/finalregister.html index 2349c5f01..387aa659f 100755 --- a/FusionIIIT/templates/academic_procedures/finalregister.html +++ b/FusionIIIT/templates/academic_procedures/finalregister.html @@ -212,10 +212,6 @@

Fee Payment

- - - - + + + diff --git a/FusionIIIT/templates/academic_procedures/studentCourses.html b/FusionIIIT/templates/academic_procedures/studentCourses.html index 7c1a9152c..1a15c3d1a 100644 --- a/FusionIIIT/templates/academic_procedures/studentCourses.html +++ b/FusionIIIT/templates/academic_procedures/studentCourses.html @@ -8,6 +8,27 @@ .modal('show') ; }); + function courseDropCalled(event) { + // Prevent the default action of the link + event.preventDefault(); + + // Get the URL from the link's href attribute + let url = event.target.href; + + // Perform AJAX request + $.ajax({ + url: url, + type: 'GET', + success: function(data) { + // Reload the page after successful deletion + location.reload(); + }, + error: function(xhr, status, error) { + // Handle errors if needed + console.error(error); + } + }); + } @@ -81,7 +102,7 @@

+ href="/academic-procedures/acad_person/verifyCourse/drop/?id={{ items.reg_id|urlencode }}" onclick="courseDropCalled(event)" > DROP
+ + + + + + + + + + + + + + + + + + + + {% for items in details %} + + + + + + + + + + + + + + {% endfor %} + + +
+ Reg ID# + + Course ID + + Course Name + + Credits + + Semester + + Replace Course +
+ {{ items.rid }} + + {{ items.course_id }} + + {{ items.course_name }} + + {{ items.credits }} + + {{ items.sem }} + + +
+ + + + + + +
+ +
+ {% else %} +
+


+
+ NO RECORDS FOUND +
+ {% endif %} + +
+ {% comment %} {% endcomment %} + + + + +
+ + + + \ No newline at end of file diff --git a/FusionIIIT/templates/academic_procedures/student_table.html b/FusionIIIT/templates/academic_procedures/student_table.html index cf74029d7..2661cbecc 100755 --- a/FusionIIIT/templates/academic_procedures/student_table.html +++ b/FusionIIIT/templates/academic_procedures/student_table.html @@ -101,7 +101,8 @@ var student_id = $(this).attr('data'); $.ajax({ type: 'post', - url: '/academic-procedures/process_verification_request/', + // url: '/academic-procedures/process_verification_request/', + url: '/academic-procedures/auto_process_verification_request/', data: { student_id: student_id, status_req: 'accept', @@ -132,7 +133,8 @@ var reason = $('#fname').val(); $.ajax({ type: 'post', - url: '/academic-procedures/process_verification_request/', + // url: '/academic-procedures/process_verification_request/', + url: '/academic-procedures/auto_process_verification_request/', data: { student_id: student_id, status_req: 'reject', diff --git a/FusionIIIT/templates/academic_procedures/studentlist.html b/FusionIIIT/templates/academic_procedures/studentlist.html index 8f43ce3d5..b3c3ea209 100755 --- a/FusionIIIT/templates/academic_procedures/studentlist.html +++ b/FusionIIIT/templates/academic_procedures/studentlist.html @@ -61,7 +61,7 @@ Verify Student Registration for Semester {{ date.semflag }} : {{ date.year }} - +
{% if course_verification_date %}
diff --git a/FusionIIIT/templates/academic_procedures/swayam_list.html b/FusionIIIT/templates/academic_procedures/swayam_list.html new file mode 100644 index 000000000..12c50c1de --- /dev/null +++ b/FusionIIIT/templates/academic_procedures/swayam_list.html @@ -0,0 +1,57 @@ +{% comment %} ACAD ADMIN WILL REPLACE COURSES WITH SWAYAM COURSES HERE {% endcomment%} +{% load static %} +{% block allot_swayam %} + + + + + +{% comment %}The tab menu starts here!{% endcomment %} + +
+
+ + {% csrf_token %} +
+ + +
+
+ +
+ + +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/ais/ais.html b/FusionIIIT/templates/ais/ais.html index be1e8e0ed..5988d5c4c 100755 --- a/FusionIIIT/templates/ais/ais.html +++ b/FusionIIIT/templates/ais/ais.html @@ -47,7 +47,7 @@

@@ -135,7 +145,7 @@
-
+
{% block generateSheet %} {% include 'ais/generateSheet.html' %} {% endblock %} @@ -170,18 +180,26 @@ {% endblock %}
-
- {% block min_credfloat_courses %} - {% include 'ais/new.html' %} + + + + + + + +
+ {% block config_pre_registration %} + {% include 'ais/pre_registration_courses.html' %} {% endblock %}
- {% block curriculum %} - {% include 'ais/curriculum.html' %} + {% block config_pre_reg_courses %} + {% include 'ais/config_courseslot_courses.html' %} {% endblock %}
+
{% block branch_change %} {% include 'academic_procedures/academicadminforbranch.html' %} @@ -206,6 +224,19 @@ {% include 'ais/student_dashboard.html' %} {% endblock %}
+ +
+ {% block allot_swayam %} + {% include 'academic_procedures/swayam_list.html' %} + {% endblock %} +
+ + +
+ {% block curriculum %} + {% include 'ais/curriculum.html' %} + {% endblock %} +
diff --git a/FusionIIIT/templates/ais/config_courseslot_courses.html b/FusionIIIT/templates/ais/config_courseslot_courses.html new file mode 100644 index 000000000..ca3bcba67 --- /dev/null +++ b/FusionIIIT/templates/ais/config_courseslot_courses.html @@ -0,0 +1,140 @@ + + + +{% load static %} +{% block config_courseslot_courses %} + + + +
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ + + + +{% endblock %} + + + + + + diff --git a/FusionIIIT/templates/ais/generateSheet.html b/FusionIIIT/templates/ais/generateSheet.html index fe03efbfd..59613a28d 100755 --- a/FusionIIIT/templates/ais/generateSheet.html +++ b/FusionIIIT/templates/ais/generateSheet.html @@ -21,7 +21,7 @@ success: function(jsondata) { $("#loading").hide(); - console.log(jsondata); + // console.log(jsondata); $('#course_list').html(jsondata.html); }, error: function(data) @@ -33,7 +33,7 @@ -
+
{% csrf_token %}
diff --git a/FusionIIIT/templates/ais/pre_registration_courses.html b/FusionIIIT/templates/ais/pre_registration_courses.html new file mode 100644 index 000000000..e861ec3c8 --- /dev/null +++ b/FusionIIIT/templates/ais/pre_registration_courses.html @@ -0,0 +1,254 @@ + + + + +{% load static %} +{% block config_pre_registration %} + + + +
+
+
+ + +
+ +
+ + +
+
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+ + +
+ +
+ +
+ + + + {% csrf_token %} + + + + + + +
+ + +
+
+
+ + + +{% endblock %} + + + + diff --git a/FusionIIIT/templates/ais/profile.html b/FusionIIIT/templates/ais/profile.html index 479de29f6..d30c5fa0e 100755 --- a/FusionIIIT/templates/ais/profile.html +++ b/FusionIIIT/templates/ais/profile.html @@ -29,7 +29,7 @@

Note : Provide the data in Excel Sheet in following format:

RollNo | First Name | Last Name | Email | Sex | DOB | Father's Name | Mother's Name | Category | Phone No | Address | Department | Specialization | Hall No -

Download the sample Excel, fill the data accordingly and then upload the same

+

Download the sample Excel, fill the data accordingly and then upload the same

diff --git a/FusionIIIT/templates/ais/student_dashboard.html b/FusionIIIT/templates/ais/student_dashboard.html index 06ad5ae92..9d1a4c45a 100644 --- a/FusionIIIT/templates/ais/student_dashboard.html +++ b/FusionIIIT/templates/ais/student_dashboard.html @@ -21,7 +21,7 @@
- +
diff --git a/FusionIIIT/templates/complaintModule/add_workers.html b/FusionIIIT/templates/complaintModule/add_workers.html index 842d4397a..969fad127 100644 --- a/FusionIIIT/templates/complaintModule/add_workers.html +++ b/FusionIIIT/templates/complaintModule/add_workers.html @@ -2,16 +2,16 @@ {% block lodgecomplaint %} {% comment %}The tab menu starts here!{% endcomment %} -