- quantitySum = reduce(lambda a, b : a['quantity'] + b['quantity'], self.items)
- priceSum = reduce(lambda a, b : a['unit_price'] * a['quantity'] + b['unit_price'] * b['quantity'], self.items)
- priceValues = priceSum.getValues()
- total = round(priceValues['taxed'], 2)
- basePrice = round(priceValues['value'], 2)
- tax = round(total - basePrice, 2)
+ if len(self.items) > 1 :
+ quantitySum = reduce(lambda a, b : a['quantity'] + b['quantity'], self.items)
+ else :
+ quantitySum = self.items[0]['quantity']
+ total = round(self.amountWithFees.getValues()['taxed'], 2)