Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Update investment table (#348)
Browse files Browse the repository at this point in the history
* Update output format for Investment table

* remove logic around withdrawals as advdvances are from future investments, not the same investment

* Correct investment output to show SUs remaining instead of total SUs
  • Loading branch information
Comeani authored Oct 10, 2023
1 parent f4666d9 commit 84fc30c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bank/account_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,13 +806,14 @@ def _build_usage_table(self) -> PrettyTable:
output_table.add_row(['Aggregate Usage', usage_percentage, ""], divider=True)
else:
investment_total = sum(inv.service_units for inv in investments)
investment_percentage = self._calculate_percentage(aggregate_usage_total,
allocation_total + investment_total)
investment_remaining = sum(inv.current_sus for inv in investments)
investment_used = investment_total - investment_remaining
investment_percentage = self._calculate_percentage(investment_used, investment_total)

output_table.add_row(['Investment SUs', "SUs Remaining", "% Used"], divider=True)
output_table.add_row([f'**Investment SUs', "",""])
output_table.add_row([f'are applied on', "", ""])
output_table.add_row([f'any cluster to', str(investment_total)+"**", investment_percentage])
output_table.add_row([f'any cluster to', str(investment_remaining)+"**", investment_percentage])
output_table.add_row([f'cover usage above',"",""])
output_table.add_row([f'Total SUs', "", ""], divider=True)
output_table.add_row(['Aggregate Usage', usage_percentage, ""])
Expand Down

0 comments on commit 84fc30c

Please sign in to comment.