From a0b38d831f74ca078d76a1bc1ddf605a2c98b9a4 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Tue, 18 Jan 2022 10:40:56 -0800 Subject: [PATCH] Fix bug penalizing a non existing taker --- api/logics.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/logics.py b/api/logics.py index 307a382a..6944aa03 100644 --- a/api/logics.py +++ b/api/logics.py @@ -45,7 +45,6 @@ class Logics(): queryset = Order.objects.filter(taker=user, status__in=active_order_status) if queryset.exists(): return False, {'bad_request':'You are already taker of an active order'} - return True, None def validate_order_size(order): @@ -208,9 +207,10 @@ class Logics(): def kick_taker(cls, order): ''' The taker did not lock the taker_bond. Now he has to go''' # Add a time out to the taker - profile = order.taker.profile - profile.penalty_expiration = timezone.now() + timedelta(seconds=PENALTY_TIMEOUT) - profile.save() + if order.taker: + profile = order.taker.profile + profile.penalty_expiration = timezone.now() + timedelta(seconds=PENALTY_TIMEOUT) + profile.save() # Make order public again order.taker = None