From a67282bf565743695c77aefa66f0ab9904e0121f Mon Sep 17 00:00:00 2001 From: Pancham Agarwal Date: Tue, 12 Dec 2023 05:09:19 +0530 Subject: [PATCH] disabled cancellation aftrer hostel checkout --- apps/nightpass/views.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/nightpass/views.py b/apps/nightpass/views.py index a5a7d2c..a406a78 100644 --- a/apps/nightpass/views.py +++ b/apps/nightpass/views.py @@ -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