Skip to content

Commit

Permalink
Revert "Merging AC-4 to Latest-Staging"
Browse files Browse the repository at this point in the history
  • Loading branch information
prabhatsuman authored Apr 24, 2024
1 parent 8855721 commit 7143741
Show file tree
Hide file tree
Showing 82 changed files with 302 additions and 9,999 deletions.
1 change: 0 additions & 1 deletion FusionIIIT/Fusion/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@
'applications.ps1',
'applications.programme_curriculum',
'applications.placement_cell',
'applications.otheracademic',
'applications.recruitment',
'applications.scholarships',
'applications.visitor_hostel',
Expand Down
2 changes: 0 additions & 2 deletions FusionIIIT/Fusion/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,4 @@
url(r'^hr2/', include('applications.hr2.urls')),
url(r'^recruitment/', include('applications.recruitment.urls')),
url(r'^examination/', include('applications.examination.urls')),
url(r'^otheracademic/', include('applications.otheracademic.urls')),

] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Binary file not shown.
9 changes: 0 additions & 9 deletions FusionIIIT/applications/academic_procedures/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,6 @@ class Meta:
def __str__(self):
return str(self.semester_id) + "-" + str(self.student_id)

class BonafideDetails(models.Model):
name=models.CharField(max_length=200)
roll_no=models.CharField(max_length=100)
discipline=models.CharField(max_length=50)
branch=models.CharField(max_length=100)
purpose=models.TextField()
class Meta:
db_table = 'BonafideDetails'


class FinalRegistrations(models.Model):
curr_id = models.ForeignKey(Curriculum, on_delete = models.CASCADE)
Expand Down
2 changes: 0 additions & 2 deletions FusionIIIT/applications/academic_procedures/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
url(r'^generate_result_pdf/$', views.generate_result_pdf),
url(r'^generate_grade_sheet_pdf/$', views.generate_grade_sheet_pdf),
url(r'^test/$', views.test),
url(r'^saveit/$', views.saveit),
url(r'^bonafide_pdf/$', views.Bonafide_form),
# url(r'^bonafide/$', views.bonafide),
url(r'^test_ret/$', views.test_ret),

url(r'^api/', include('applications.academic_procedures.api.urls')),
Expand Down
28 changes: 3 additions & 25 deletions FusionIIIT/applications/academic_procedures/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
ExtraInfo, Faculty, HoldsDesignation)
from applications.programme_curriculum.models import Course as Courses
from .models import (BranchChange, CoursesMtech, InitialRegistration, StudentRegistrationChecks,
Register, Thesis, FinalRegistration, ThesisTopicProcess,BonafideDetails,
Register, Thesis, FinalRegistration, ThesisTopicProcess,
Constants, FeePayments, TeachingCreditRegistration, SemesterMarks,
MarkSubmissionCheck, Dues,AssistantshipClaim, MTechGraduateSeminarReport,
PhDProgressExamination,CourseRequested, course_registration, MessDue, Assistantship_status , backlog_course)
Expand Down Expand Up @@ -3374,7 +3374,7 @@ def Bonafide_form(request):
# # if this is a POST request we need to process the form data
# if request.method == 'POST':
# # create a form instance and populate it with data from the request:
# form = Bonafide_form(request.POST)
# form = BonafideForm(request.POST)
# # check whether it's valid:
# if form.is_valid():
# # process the data in form.cleaned_data as required
Expand All @@ -3384,32 +3384,10 @@ def Bonafide_form(request):

# # if a GET (or any other method) we'll create a blank form
# else:
# form = Bonafide_form()
# form = BonafideForm()

# return render(request, 'bonafide.html', {'form': form})


def saveit(request):
# if this is a POST request we need to process the form data
if request.method == 'POST':
name=request.POST.get('name')
branch=request.POST.get('branch')
purpose=request.POST.get('purpose')
discipline=request.POST.get('discipline')
roll_no=request.POST.get('roll_no')
data=BonafideDetails(name=name,roll_no=roll_no,branch=branch,discipline=discipline,purpose=purpose)
data.save()
message=""
message= message + "Form submitted succesfully"
res="Done"
content = {
'status' : res,
'message' : message
}
content = json.dumps(content)
return HttpResponse(content)


@login_required
def ACF(request):
stu = Student.objects.get(id=request.user.username)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ class Migration(migrations.Migration):
'db_table': 'Tracking',
},
),
]
]
77 changes: 17 additions & 60 deletions FusionIIIT/applications/leave/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class StudentApplicationForm(forms.Form):
end_date = forms.DateField(label='To')
purpose = forms.CharField(label='Purpose', widget=forms.TextInput)
address = forms.CharField(label='Address')
document = forms.FileField(label='Related Document', required=False, widget=forms.ClearableFileInput(attrs={'multiple': True}))
document = forms.FileField(label='Related Document', required=False)

def __init__(self, *args, **kwargs):
if 'user' in kwargs:
Expand All @@ -32,60 +32,32 @@ def clean(self, *args, **kwargs):
super(StudentApplicationForm, self).clean(*args, **kwargs)
data = self.cleaned_data
errors = dict()


today = timezone.now().date()
if data.get('start_date') < today:
"""if data.get('start_date') < today:
errors['start_date'] = ['Past Dates are not allowed']
if data.get('end_date') < today:
errors['end_date'] = ['Past Dates are not allowed']

try:
fileS = data.get('document').size
if int(fileS) > 2048000:
errors['document'] = ['Documents must not be greater than 2Mb']
except:
pass


"""
lt = LeaveType.objects.filter(name=data.get('leave_type')).first()

# if lt is None, use default
if lt is None:
lt = LeaveType()

if lt.requires_proof and not data.get('document'):
errors['document'] = [f'{lt.name} Leave requires document proof']

try:
if data.get('start_date') > data.get('end_date'):
if 'start_date' in errors:
errors['start_date'].append('Start Date must be less than End Date')
else:
errors['start_date'] = ['Start Date must be less than End Date']
except:
pass

try:
leave_type = LeaveType.objects.get(name=data.get('leave_type'))
except LeaveType.DoesNotExist:
leave_type = LeaveType()
if data.get('start_date') > data.get('end_date'):
if 'start_date' in errors:
errors['start_date'].append('Start Date must be less than End Date')
else:
errors['start_date'] = ['Start Date must be less than End Date']

leave_type = LeaveType.objects.get(name=data.get('leave_type'))
count = get_leave_days(data.get('start_date'), data.get('end_date'),
leave_type, False, False)

try:
remaining_leaves = LeavesCount.objects.get(user=self.user, leave_type=leave_type) \
remaining_leaves = LeavesCount.objects.get(user=self.user, leave_type=leave_type) \
.remaining_leaves
except LeavesCount.DoesNotExist:
remaining_leaves = LeavesCount().remaining_leaves

try:
if remaining_leaves < count:
errors['leave_type'] = f'You have only {remaining_leaves} {leave_type.name} leaves' \
' remaining.'
except:
pass
if remaining_leaves < count:
errors['leave_type'] = f'You have only {remaining_leaves} {leave_type.name} leaves' \
' remaining.'

raise VE(errors)

Expand Down Expand Up @@ -145,11 +117,7 @@ def clean(self, *args, **kwargs):
errors = dict()

def check_special_leave_overlap(start_date, end_date, leave_type_id):
try:
leave_type = LeaveType.objects.get(id=leave_type_id)
except LeaveType.DoesNotExist:
leave_type = LeaveType()

leave_type = LeaveType.objects.get(id=leave_type_id)
if leave_type.name.lower() in ['restricted']:
count = get_special_leave_count(start_date, end_date, leave_type.name.lower())
if count < 0:
Expand Down Expand Up @@ -356,11 +324,7 @@ def clean(self):
for form in self.forms:
try:
data = form.cleaned_data

try:
leave_type = LeaveType.objects.get(id=data.get('leave_type'))
except LeaveType.DoesNotExist:
leave_type = LeaveType()
leave_type = LeaveType.objects.get(id=data.get('leave_type'))
#if leave_type.is_station:
# continue

Expand Down Expand Up @@ -435,11 +399,7 @@ def clean(self, *args, **kwargs):
errors = dict()

def check_special_leave_overlap(start_date, end_date, leave_type_id):
try:
leave_type = LeaveType.objects.get(id=leave_type_id)
except LeaveType.DoesNotExist:
leave_type = LeaveType()

leave_type = LeaveType.objects.get(id=leave_type_id)
if leave_type.name.lower() in ['restricted']:
count = get_special_leave_count(start_date, end_date, leave_type.name.lower())
if count < 0:
Expand Down Expand Up @@ -615,10 +575,7 @@ def clean(self):
for form in self.forms:
try:
data = form.cleaned_data
try:
leave_type = LeaveType.objects.get(id=data.get('leave_type'))
except LeaveType.DoesNotExist:
leave_type = LeaveType()
leave_type = LeaveType.objects.get(id=data.get('leave_type'))
#if leave_type.is_station:
# continue

Expand Down
12 changes: 2 additions & 10 deletions FusionIIIT/applications/leave/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,8 @@ def handle_student_leave_application(request):
purpose=data.get('purpose'),
extra_info=data.get('leave_info'),
)
leave.save()

try:
leave_type = LeaveType.objects.get(name=data.get('leave_type'))
except LeaveType.DoesNotExist:
leave_type = LeaveType()

leave_type.save()
leave_type = LeaveType.objects.get(name=data.get('leave_type'))

LeaveSegment.objects.create(
leave=leave,
Expand All @@ -291,9 +285,7 @@ def handle_student_leave_application(request):
start_date=data.get('start_date'),
end_date=data.get('end_date')
)

requested_from = request.user

requested_from = request.user.leave_admins.authority.designees.first().user
LeaveRequest.objects.create(
leave=leave,
requested_from=requested_from
Expand Down
49 changes: 20 additions & 29 deletions FusionIIIT/applications/leave/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@
def get_designation(user):
desig = list(HoldsDesignation.objects.all().filter(working = user).values_list('designation'))
b = [i for sub in desig for i in sub]
try:
c=str(Designation.objects.get(id=b[0]))
for i in b:
obj = Designation.objects.get(id=i)
if str(obj)=='Assistant Registrar':
c='Assistant Registrar'
elif str(obj)== 'administrative':
c='administrative'
except:
c = 'administrative'

c=str(Designation.objects.get(id=b[0]))
for i in b:
if str(Designation.objects.get(id=i))=='Assistant Registrar':
c='Assistant Registrar'
break
print(c)
return c

Expand Down Expand Up @@ -100,24 +94,21 @@ def get_leave_days(start, end, leave_type, start_half, end_half):
# TODO: Remove this hard code and make it database dependent
# Maybe add one field in leave type, which tells that this has to be taken from
# academic calendar
try:
if leave_name.lower()=='restricted':
count = get_special_leave_count(start, end, leave_name.lower())
elif leave_name.lower()=='vacation':
count = get_vacation_leave_count(start, end, leave_name.lower())
else:
while start <= end:
if not start.weekday() in [5, 6]:
count += 1.0

start = start + datetime.timedelta(days=1)

if start_half and start.weekday() not in [5, 6]:
count -= 0.5
if end_half and end.weekday() not in [5, 6]:
count -= 0.5
except:
pass
if leave_name.lower()=='restricted':
count = get_special_leave_count(start, end, leave_name.lower())
elif leave_name.lower()=='vacation':
count = get_vacation_leave_count(start, end, leave_name.lower())
else:
while start <= end:
if not start.weekday() in [5, 6]:
count += 1.0

start = start + datetime.timedelta(days=1)

if start_half and start.weekday() not in [5, 6]:
count -= 0.5
if end_half and end.weekday() not in [5, 6]:
count -= 0.5

return count

Expand Down
2 changes: 1 addition & 1 deletion FusionIIIT/applications/leave/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Constants:

#@python_2_unicode_compatible
class LeaveType(models.Model):
name = models.CharField(max_length=40, null=False, default='casual')
name = models.CharField(max_length=40, null=False)
max_in_year = models.IntegerField(default=2)
requires_proof = models.BooleanField(default=False)
authority_forwardable = models.BooleanField(default=False)
Expand Down
Empty file.
18 changes: 0 additions & 18 deletions FusionIIIT/applications/otheracademic/admin.py

This file was deleted.

6 changes: 0 additions & 6 deletions FusionIIIT/applications/otheracademic/apps.py

This file was deleted.

Empty file.
Empty file.
Loading

0 comments on commit 7143741

Please sign in to comment.