Skip to content

Commit

Permalink
added back missing code
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago Silva committed Mar 31, 2016
1 parent b7e3d86 commit d6a46c7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/budy/models/product.py
Expand Up @@ -342,3 +342,27 @@ def get_price_ripe(
)
total = result["total"]
return total["price_final"]

def get_size(self, currency = None, country = None, attributes = None):
if not self.price_provider: return None, None
method = getattr(self, "get_size_%s" % self.price_provider)
return method(
country = country,
attributes = attributes
)

def get_size_ripe(
self,
currency = None,
country = None,
attributes = None
):
attributes_m = json.loads(attributes)
size = attributes_m["size"]
scale = attributes_m["scale"]
gender = attributes_m["gender"]

if gender == "male": converter = lambda native: ((native - 17) / 2) + 36
else: converter = lambda native: ((native - 17) / 2) + 34

return converter(size), scale

0 comments on commit d6a46c7

Please sign in to comment.