Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Revert "Ac 5" #1571

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion FusionIIIT/applications/globals/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<username>.+)/', views.profile, name='profile-api'),
# current user profile
url(r'^profile/', views.profile, name='profile-api'),
Expand Down
4 changes: 0 additions & 4 deletions FusionIIIT/applications/globals/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ 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
Expand All @@ -146,7 +143,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 ''))
elif profile['user_type'] == 'staff':
resp = {
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion FusionIIIT/applications/globals/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,6 @@ def profile(request, username=None):
"""



user = get_object_or_404(User, Q(username=username)) if username else request.user
editable = request.user == user
print("editable",editable)
Expand Down
2 changes: 1 addition & 1 deletion FusionIIIT/applications/scholarships/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
url(r'^updateEndDate/$', views.updateEndDate, name='updateEndDate'),
url(r'^deleteRelease/$', views.deleteRelease, name='deleteRelease'),

]
]
95 changes: 55 additions & 40 deletions FusionIIIT/applications/scholarships/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,28 +110,36 @@ def convener_view(request):
# It updates the student Notification table on the spacs head sending the mcm invitation
if batch == 'All':
active_batches = range(datetime.datetime.now().year - 4 , datetime.datetime.now().year + 1)

query = reduce(or_, (Q(id__id__startswith=int(batch)-2000) for batch in active_batches))
# active_batches=str(active_batches)
# active_batches.split(',')
print(active_batches)
querybatch = []
for curbatch in active_batches:
if curbatch > 2019:
curbatch=curbatch%2000
querybatch.append(curbatch)
print( active_batches)
query = reduce(or_, (Q(id__id__startswith=batch) for batch in querybatch))
print(query)
recipient = Student.objects.filter(programme=programme).filter(query)
else:
recipient = Student.objects.filter(programme=programme, id__id__startswith=int(batch)-2000)

if(int(batch)>2019):
curbatch=int(batch)%2000
recipient = Student.objects.filter(programme=programme, id__id__startswith=curbatch)

# Notification starts
print(recipient)
convenor = request.user
for student in recipient:
scholarship_portal_notif(convenor, student.id.user, 'award_' + award) # Notification
if award == 'Merit-cum-Means Scholarship':
print("MCM")
rel = Release.objects.get(date_time=d_time)
Notification.objects.select_related('student_id','release_id').bulk_create([Notification(
release_id=rel,
student_id=student,
notification_mcm_flag=True,
invite_mcm_accept_flag=False) for student in recipient])
else:
print("convo")
rel = Release.objects.get(date_time=d_time)
Notification.objects.select_related('student_id','release_id').bulk_create([Notification(
release_id=rel,
Expand Down Expand Up @@ -161,10 +169,8 @@ def convener_view(request):
year = datetime.datetime.now().year
Mcm.objects.select_related('award_id','student').filter(id=pk).update(status='Accept')
request.session['last_clicked'] = 'Accept_MCM'
zest=Previous_winner.objects.filter(student = student_id, year=year, award_id=award)
print(zest)
if(len(zest)==0):
Previous_winner.objects.create(student=student_id, year=year, award_id=award)
Previous_winner.objects.create(
student=student_id, year=year, award_id=award)
convenor = request.user
recipient = student_id
scholarship_portal_notif(convenor, recipient.id.user, 'Accept_MCM')
Expand All @@ -188,10 +194,8 @@ def convener_view(request):
student_id = Director_gold.objects.select_related('student','award_id').get(id=pk).student
year = datetime.datetime.now().year
Director_gold.objects.select_related('student','award_id').filter(id=pk).update(status='Accept')
zest=Previous_winner.objects.filter(student = student_id, year=year, award_id=award)
print(zest)
if(len(zest)==0):
Previous_winner.objects.create(student=student_id, year=year, award_id=award)
Previous_winner.objects.create(
student=student_id, year=year, award_id=award)
convenor = request.user
recipient = student_id
scholarship_portal_notif(
Expand All @@ -218,13 +222,12 @@ def convener_view(request):
student_id = Director_silver.objects.select_related('student','award_id').get(id=pk).student
year = datetime.datetime.now().year
Director_silver.objects.select_related('student','award_id').filter(id=pk).update(status='Accept')
zest=Previous_winner.objects.filter(student = student_id, year=year, award_id=award)
print(zest)
if(len(zest)==0):
Previous_winner.objects.create(student=student_id, year=year, award_id=award)
Previous_winner.objects.create(
student=student_id, year=year, award_id=award)
convenor = request.user
recipient = student_id
scholarship_portal_notif(convenor, recipient.id.user, 'Accept_Silver')
scholarship_portal_notif(
convenor, recipient.id.user, 'Accept_Silver')
request.session['last_clicked'] = 'Accept_Silver'
messages.success(request, 'Application is accepted')
return HttpResponseRedirect('/spacs/convener_view')
Expand All @@ -235,7 +238,8 @@ def convener_view(request):
Director_silver.objects.select_related('student','award_id').filter(id=pk).update(status='Reject')
convenor = request.user
recipient = student_id
scholarship_portal_notif(convenor, recipient.id.user, 'Reject_Silver')
scholarship_portal_notif(
convenor, recipient.id.user, 'Reject_Silver')
request.session['last_clicked'] = 'Reject_Silver'
messages.success(request, 'Application is rejected')
return HttpResponseRedirect('/spacs/convener_view')
Expand All @@ -246,10 +250,8 @@ def convener_view(request):
student_id = Proficiency_dm.objects.select_related('student','award_id').get(id=pk).student
year = datetime.datetime.now().year
Proficiency_dm.objects.select_related('student','award_id').filter(id=pk).update(status='Accept')
zest=Previous_winner.objects.filter(student = student_id, year=year, award_id=award)
print(zest)
if(len(zest)==0):
Previous_winner.objects.create(student=student_id, year=year, award_id=award)
Previous_winner.objects.create(
student=student_id, year=year, award_id=award)
convenor = request.user
recipient = student_id
scholarship_portal_notif(convenor, recipient.id.user, 'Accept_DM')
Expand Down Expand Up @@ -452,7 +454,6 @@ def getWinners(request):
return JsonResponse(context)

def get_MCM_Flag(request): # Here we are extracting mcm_flag
print("get mcm_flags here")
x = Notification.objects.select_related('student_id','release_id').filter(student_id=request.user.extrainfo.id)
for i in x:
i.invite_mcm_accept_flag = True
Expand All @@ -469,9 +470,7 @@ def get_MCM_Flag(request): # Here we are extracting mcm_flag
# return HttpResponseRedirect('/spacs/student_view')

def getConvocationFlag(request): # Here we are extracting convocation_flag

print("get convo_flags here")
x = Notification.objects.filter(student_id=request.user.extrainfo.id)
x = Notification.objects.select_related('student_id', 'release_id').filter(student_id=request.user.extrainfo.id)
for i in x:
i.invite_convocation_accept_flag = True
i.save()
Expand Down Expand Up @@ -1094,39 +1093,55 @@ def sendStudentRenderRequest(request, additionalParams={}):
student_batch = getBatch(request.user.extrainfo.student)
for dates in release:
if checkDate(dates.startdate, dates.enddate):
print("sudheer's test --->")
print(request.user.extrainfo.student)
print(str(request.user.extrainfo.student)[0:2])
if dates.award == 'Merit-cum-Means Scholarship' and dates.batch == "20"+str(request.user.extrainfo.student)[0:2]and dates.programme == request.user.extrainfo.student.programme:
curBatch = dates.batch
checkBatch = str(request.user.extrainfo.student)[0:4]
batchCondition = False
if checkBatch[2] >= "A" and checkBatch[2] <= "Z":
if(curBatch == 'All'):
batchRange = range(datetime.datetime.now().year - 4, datetime.datetime.now().year + 1)
for batches in batchRange :
if int(checkBatch[0:2]) == batches % 2000:
batchCondition = True
elif curBatch == checkBatch:
batchCondition = True
else:
if(curBatch == 'All'):
batchRange = range(datetime.datetime.now().year - 4, datetime.datetime.now().year + 1)
for batch in batchRange:
if str(checkBatch) == batch:
batchCondition = True
elif curBatch == checkBatch:
True
print("bye")


print(curBatch, checkBatch)
if dates.award == 'Merit-cum-Means Scholarship' and batchCondition and dates.programme == request.user.extrainfo.student.programme:
x_notif_mcm_flag = True
if no_of_mcm_filled > 0:
update_mcm_flag = True
elif dates.award == 'Convocation Medals' and dates.batch == "20"+str(request.user.extrainfo.student)[0:2]and dates.programme == request.user.extrainfo.student.programme:
elif dates.award == 'Convocation Medals' and dates.batch == student_batch and dates.programme == request.user.extrainfo.student.programme:
x_notif_con_flag = True
if no_of_con_filled > 0:
update_con_flag = True
else:


if dates.award == "Merit-cum-Means Scholarship" and dates.batch =="20"+ str(request.user.extrainfo.student)[0:2]:
if dates.award == "Merit-cum-Means Scholarship" and dates.batch == student_batch:
try:
x = Notification.objects.select_related('student_id','release_id').get(
student_id=request.user.extrainfo.id, release_id=dates.id).delete()
except:
pass
elif dates.award == 'Convocation Medals' and dates.batch == "20"+str(request.user.extrainfo.student)[0:2]:
elif dates.award == 'Convocation Medals' and dates.batch == student_batch:
try:
x = Notification.objects.select_related('student_id','release_id').get(
student_id=request.user.extrainfo.id, release_id=dates.id).delete()
except:
pass

x = Notification.objects.select_related('student_id','release_id').filter(student_id=request.user.extrainfo.id).order_by('-release_id__date_time')
print(x)
show_mcm_flag = False
show_convocation_flag = False
for i in x:
print(i.invite_convocation_accept_flag)
if i.invite_mcm_accept_flag == True:
show_mcm_flag = True
break
Expand Down Expand Up @@ -1172,4 +1187,4 @@ def getCommonParams(request):
context = {'mcm': mcm, 'awards': awards, 'student': student, 'gold': gold, 'silver': silver,
'dandm': dandm, 'con': con, 'assis': assis, 'hd': hd, 'hd1': hd1,
'last_clicked': last_clicked, 'year_range': year_range, 'active_batches': active_batches}
return context
return context
2 changes: 1 addition & 1 deletion FusionIIIT/templates/scholarshipsModule/applyNew.html
Original file line number Diff line number Diff line change
Expand Up @@ -1129,4 +1129,4 @@
</script>

</body>
{% endblock %}
{% endblock %}
2 changes: 1 addition & 1 deletion FusionIIIT/templates/scholarshipsModule/invite.html
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,4 @@
}
</script>

{% endblock %}
{% endblock %}
Loading