Skip to content

Instantly share code, notes, and snippets.

@jobelenus
Created October 22, 2013 15:59
Show Gist options
  • Save jobelenus/7103289 to your computer and use it in GitHub Desktop.
Save jobelenus/7103289 to your computer and use it in GitHub Desktop.
if num_days <= 3:
if order_is_shipping:
price = model.three_day_rate * qty
else:
price = model.four_day_rate * qty
elif num_days == 4:
price = model.four_day_rate * qty
elif num_days > 4:
days_amount = max(0, self._calculate_price_for_days(num_days-4, qty=qty, model=model))
price = (model.four_day_rate * qty) + days_amount
ship_cost = max(0,model.shipping_cost) * qty if add_ship_cost else Decimal('0')
total = price + ship_cost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment