Skip to content

Commit

Permalink
tiny code change
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Sep 14, 2018
1 parent 044e069 commit 388bbc3
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/budy/models/bundle_line.py
Expand Up @@ -184,7 +184,6 @@ def ensure_valid(self):

def try_valid(self):
fixed = False
fixed |= self.try_valid_merchandise()
fixed |= self.try_valid_quantity()
fixed |= self.try_valid_price()
return fixed
Expand All @@ -195,18 +194,9 @@ def try_valid_s(self):
self.save()
return fixed

def try_valid_merchandise(self):
fixed = False
if self.merchandise.is_resolvable(): return fixed
self.quantity = 0.0
self.calculate(force = True)
fixed |= True
return fixed

def try_valid_quantity(self):
fixed = False
if self.quantity <= 0.0: self.quantity = 0.0
if not self.merchandise.is_resolvable(): return fixed
if self.merchandise.quantity_hand == None: return fixed
if self.quantity <= self.merchandise.quantity_hand: return fixed
self.quantity = min(self.quantity, self.merchandise.quantity_hand)
Expand All @@ -216,7 +206,6 @@ def try_valid_quantity(self):

def try_valid_price(self):
fixed = False
if not self.merchandise.is_resolvable(): return fixed
if self.merchandise.is_price_provided: return fixed
if self.merchandise.price == None: return fixed
if self.merchandise.price == self.price: return fixed
Expand Down

0 comments on commit 388bbc3

Please sign in to comment.