test
This commit is contained in:
@@ -257,6 +257,7 @@ class Broker(BaseModel):
|
||||
broker_type = models.CharField(choices=BROKER_TYPES, max_length=20, null=True)
|
||||
fix_broker_price = models.PositiveBigIntegerField(default=0)
|
||||
fix_broker_price_state = models.BooleanField(default=False)
|
||||
suggested_broker_price = models.PositiveBigIntegerField(default=0)
|
||||
required = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
@@ -43,16 +43,16 @@ class QuotaDistributionService:
|
||||
}
|
||||
|
||||
@transaction.atomic
|
||||
def consume(self, weight): # noqa
|
||||
def consume(self, amount): # noqa
|
||||
"""
|
||||
Consume 'amount' of weight across all distributions in order.
|
||||
Automatically splits usage if needed.
|
||||
"""
|
||||
|
||||
if weight > self.remaining_weight:
|
||||
if amount > self.remaining_weight:
|
||||
raise APIException('Not enough weight to consume')
|
||||
|
||||
remaining_to_consume = weight
|
||||
remaining_to_consume = amount
|
||||
|
||||
for dist in self.distribution.select_for_update():
|
||||
if remaining_to_consume <= 0:
|
||||
|
||||
Reference in New Issue
Block a user