10 febrer 2024

This commit is contained in:
Roger Oriol Pérez
2024-02-10 21:32:09 +01:00
parent 2a80d18eb4
commit 3067394dec
5 changed files with 101 additions and 232 deletions

View File

@@ -66,9 +66,9 @@ def get_total_outflows(expenses, total_investments):
return total_investments
def get_total_investments(investments):
sum = 0
sum = Amount(Decimal(0), "EUR")
for inv in investments:
sum = inv.cost_position if sum == 0 else sum + inv.cost_position
sum = inv.cost_position if sum == Amount(Decimal(0), "EUR") else add(sum, inv.cost_position)
if sum != 0 and sum != None:
return Amount(Decimal(round(sum.number, 2)), sum.currency)
else: