Skip to content

Commit

Permalink
disabled cancellation aftrer hostel checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
Pancham1603 committed Dec 11, 2023
1 parent eb5ab96 commit a67282b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions apps/nightpass/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,13 @@ def cancel_pass(request):
}
return HttpResponse(json.dumps(data))
else:
if user_nightpass.check_out and user_nightpass.check_in:
if user_nightpass.check_out or user_nightpass.check_in or user_nightpass.hostel_checkout_time:
data={
'status':False,
'message':f"Cannot cancel pass after utilization."
}
return HttpResponse(json.dumps(data))
elif user_nightpass.check_in:
data={
'status':False,
'message':f"Cannot cancel pass once you enter {user_nightpass.campus_resource}."
}
return HttpResponse(json.dumps(data))

else:
user_nightpass.delete()
user_nightpass.campus_resource.slots_booked -= 1
Expand Down

0 comments on commit a67282b

Please sign in to comment.