Skip to content

Commit

Permalink
Reverted funding summary bar plot to previous method of calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
phillybroadbent committed Nov 16, 2023
1 parent 7748d73 commit b14743d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 31 deletions.
10 changes: 2 additions & 8 deletions lowfat/models/claimant.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def claimantship_committed(self):
status__in=['A', 'M', 'F']
)])

return sum([fund.budget_approved for fund in this_claimant_funds]) - (spent_from_committed_final + spent_from_committed_other)
return sum([fund.budget_approved for fund in this_claimant_funds]) - (spent_from_committed_final + spent_from_committed_other)

def claimantship_spent(self):
"""Return the amount already spent from the claimantship grant."""
Expand All @@ -465,10 +465,4 @@ def claimantship_spent(self):
grant_heading="F"
)

return sum([expense.amount_authorized_for_payment for expense in this_claimant_expenses])

def claimantship_total(self):
"""The total of available, committed, spent and passed funds.
To be used for the width of the money bar graph to prevent it spilling onto 2 lines."""

return self.claimantship_committed() + self.claimantship_spent() + abs(self.claimantship_available()) + self.claimantship_passed()
return sum([expense.amount_authorized_for_payment for expense in this_claimant_expenses])
34 changes: 11 additions & 23 deletions lowfat/templates/lowfat/finances.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,28 @@ <h2>Finances</h2>
<figure>
<div class="money-bar-graph">
{% if claimant.claimantship_spent > 0 %}
<span style="width:{% widthratio claimant.claimantship_spent claimant.claimantship_total 100 %}%"
<span style="width:{% widthratio claimant.claimantship_spent 3000 100 %}%"
class="money-used"
title="Spent">
£{{ claimant.claimantship_spent|floatformat:2 }}
</span>
{% endif %}
{% if claimant.claimantship_committed > 0 %}
<span style="width:{% widthratio claimant.claimantship_committed claimant.claimantship_total 100 %}%"
<span style="width:{% widthratio claimant.claimantship_committed 3000 100 %}%"
class="money-reserved"
title="Commited">
title="Committed">
£{{ claimant.claimantship_committed|floatformat:2 }}
</span>
{% endif %}
{% if claimant.claimantship_available > 0 %}
<span style="width:{% widthratio claimant.claimantship_available claimant.claimantship_total 100 %}%"
{% if claimant.claimantship_available %}
<span style="width:{% widthratio claimant.claimantship_available 3000 100 %}%"
class="money-available"
title="Available">
£{{ claimant.claimantship_available|floatformat:2 }}
</span>
{% endif %}
{% if claimant.claimantship_available < 0 %}
<span style="width:{% widthratio claimant.claimantship_available claimant.claimantship_total 100 %}%"
class="money-passed"
title="Available">
£{{ claimant.claimantship_available|floatformat:2 }}
</span>
{% endif %}
{% if claimant.claimantship_passed %}
<span style="width:{% widthratio claimant.claimantship_passed claimant.claimantship_total 100 %}%"
<span style="width:{% widthratio claimant.claimantship_passed 3000 100 %}%"
class="money-passed"
title="Passed">
£{{ claimant.claimantship_passed|floatformat:2 }}
Expand All @@ -43,26 +36,21 @@ <h2>Finances</h2>
<table class="table table-bordered">
<tbody>
<tr>
<th>Grant <span title="Initial fellowship grant" class="fa-solid fa-question" aria-hidden="true"></span>
<th>Grant <span title="Initial fellowship grant" class="glyphicon glyphicon-question-sign" aria-hidden="true"></span>
</th>
<td>£{{ claimant.claimantship_grant|floatformat:2 }}</td>
</tr>
<tr>
<th>Available (until {{ claimant.inauguration_grant_expiration }}) <span title="Fellowship grant not committed or spent" class="fa-solid fa-question" aria-hidden="true"></span></th>
<th>Available (until {{ claimant.inauguration_grant_expiration }}) <span title="Fellowship grant not committed or spent" class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></th>
<td>£{{ claimant.claimantship_available|floatformat:2 }}</td>
</tr>
<tr>
<th>Committed <span title="Sum of approved funding requests' budget" class="fa-solid fa-question" aria-hidden="true"></span></th>
<th>Committed <span title="Sum of approved funding requests' budget" class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></th>
<td>£{{ claimant.claimantship_committed|floatformat:2 }}</td>
</tr>
<tr>
<th>Spent <span title="Sum of all approved expenses claim" class="fa-solid fa-question" aria-hidden="true"></span></th>
<th>Spent <span title="Sum of all approved expenses claim" class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></th>
<td>£{{ claimant.claimantship_spent|floatformat:2 }}</td>
<tr>
<tr>
<th>Total <span title="Sum of all categories" class="fa-solid fa-question" aria-hidden="true"></span></th>
<td>£{{ claimant.claimantship_total|floatformat:2 }}</td>
<tr>

</tbody>
</table>
</table>

0 comments on commit b14743d

Please sign in to comment.