Skip to content

Commit ca7daf8

Browse files
committed
fix lookup of allocation user email
1 parent 009fd60 commit ca7daf8

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

home/views.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ def rebate(request):
169169
for period in Period.objects.all()
170170
if period.end_date > date.today() + timedelta(1)
171171
)
172-
allocation = Allocation.objects.get(
173-
email__iexact=request.user.email, period=period_obj
174-
)
172+
allocation = Allocation.objects.get(email=student, period=period_obj)
175173
except Exception as e:
176174
logger.error(e)
177175
message = "You are not allocated for current period, please contact the dining warden to allocate you to a caterer"
@@ -256,7 +254,7 @@ def rebate(request):
256254
if text != "":
257255
del request.session["text"]
258256
if not allocation:
259-
context = {"text":text}
257+
context = {"text": text}
260258
else:
261259
context = {"text": text, "key": allocation.student_id}
262260
return render(request, "rebateForm.html", context)
@@ -355,7 +353,6 @@ def addLongRebateBill(request):
355353
return render(request, "longRebate.html", context)
356354

357355

358-
359356
@login_required
360357
def allocationForm(request):
361358
"""
@@ -378,7 +375,7 @@ def allocationForm(request):
378375
student = Student.objects.filter(email__iexact=str(request.user.email)).last()
379376
if not student:
380377
message = "Signed in account cannot fill the allocation form. Please inform the dining Office to add your email ID to the database"
381-
elif not student.allocation_enabled:
378+
elif not student.allocation_enabled:
382379
message = "You are not eligible to fill out this allocation form. For more details, please inquire at the Dining Office."
383380
elif (alloc_form.start_time and alloc_form.start_time > now()) or (
384381
alloc_form.end_time and alloc_form.end_time < now()

0 commit comments

Comments
 (0)