mirror of
https://github.com/RoboSats/robosats.git
synced 2025-07-24 00:33:20 +00:00
Fix bug penalizing a non existing taker
This commit is contained in:
@ -45,7 +45,6 @@ class Logics():
|
|||||||
queryset = Order.objects.filter(taker=user, status__in=active_order_status)
|
queryset = Order.objects.filter(taker=user, status__in=active_order_status)
|
||||||
if queryset.exists():
|
if queryset.exists():
|
||||||
return False, {'bad_request':'You are already taker of an active order'}
|
return False, {'bad_request':'You are already taker of an active order'}
|
||||||
|
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
def validate_order_size(order):
|
def validate_order_size(order):
|
||||||
@ -208,9 +207,10 @@ class Logics():
|
|||||||
def kick_taker(cls, order):
|
def kick_taker(cls, order):
|
||||||
''' The taker did not lock the taker_bond. Now he has to go'''
|
''' The taker did not lock the taker_bond. Now he has to go'''
|
||||||
# Add a time out to the taker
|
# Add a time out to the taker
|
||||||
profile = order.taker.profile
|
if order.taker:
|
||||||
profile.penalty_expiration = timezone.now() + timedelta(seconds=PENALTY_TIMEOUT)
|
profile = order.taker.profile
|
||||||
profile.save()
|
profile.penalty_expiration = timezone.now() + timedelta(seconds=PENALTY_TIMEOUT)
|
||||||
|
profile.save()
|
||||||
|
|
||||||
# Make order public again
|
# Make order public again
|
||||||
order.taker = None
|
order.taker = None
|
||||||
|
Reference in New Issue
Block a user