Skip to content

Commit

Permalink
Merge pull request #739 from softwaresaved/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
phillybroadbent authored Nov 6, 2023
2 parents 103d178 + 7748d73 commit 76c30e9
Show file tree
Hide file tree
Showing 17 changed files with 133 additions and 83 deletions.
4 changes: 2 additions & 2 deletions lowfat/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,13 +872,13 @@ def __init__(self, *args, **kwargs):
<p>
Before submitting your expense claim:
<ol>
<li>Please follow the <a href='https://software.ac.uk/SSI-expenses-guidelines'>Guidelines for reimbursement of expenses from the Software Sustainability Institute</a>.
<li>Please follow the <a href='https://www.software.ac.uk/guide/guidelines-reimbursement-expenses-supported-software-sustainability-institute'>Guidelines for reimbursement of expenses from the Software Sustainability Institute</a>.
<ul>
<li>The Fellowship Programme Terms and Conditions and the <a href="https://www.ed.ac.uk/sites/default/files/atoms/files/new_expenses_policy.docx">University of Edinburgh Finance Expenses Policy</a> apply to your claim.
</li>
</ul>
</li>
<li>You MUST fill out the University of Edinburgh Payment of Non-Staff <a href='https://www.software.ac.uk/attach/Non_staff_expenses_claim_form_-_with_list_2023.docx'>Expenses form</a>.
<li>You MUST fill out the <a href='https://www.ed.ac.uk/sites/default/files/atoms/files/non_staff_expenses_claim_form_v3.docx'>University of Edinburgh Payment of Non-Staff Expenses form</a>.
<ul>
<li>Fill out Sections 1-4 (pages 1-2) and page 6.</li>
<li>Leave the visitor/student number blank.</li>
Expand Down
23 changes: 23 additions & 0 deletions lowfat/migrations/0159_auto_20230824_1428.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.15 on 2023-08-24 14:28

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('lowfat', '0158_auto_20230228_1404'),
]

operations = [
migrations.AlterField(
model_name='expense',
name='final',
field=models.BooleanField(default=True),
),
migrations.AlterField(
model_name='historicalexpense',
name='final',
field=models.BooleanField(default=True),
),
]
21 changes: 18 additions & 3 deletions lowfat/models/claimant.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,23 @@ def claimantship_committed(self):
grant_heading="F"
)

spent_from_committed = 0
spent_from_committed_final = 0
spent_from_committed_other = 0

for fund in this_claimant_funds:
spent_from_committed += sum([expense.fund.budget_approved for expense in Expense.objects.filter(
spent_from_committed_final += sum([expense.fund.budget_approved for expense in Expense.objects.filter(
fund=fund,
final=True,
status__in=['A', 'M', 'F']
)])

return sum([fund.budget_approved for fund in this_claimant_funds]) - spent_from_committed
spent_from_committed_other += sum([expense.amount_authorized_for_payment for expense in Expense.objects.filter(
fund=fund,
final=False,
status__in=['A', 'M', 'F']
)])

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 @@ -457,3 +466,9 @@ def claimantship_spent(self):
)

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()
2 changes: 1 addition & 1 deletion lowfat/models/expense.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class Meta:
default=False
)
final = models.BooleanField(
default=False
default=True
)
advance_booking = models.BooleanField(
default=False
Expand Down
4 changes: 2 additions & 2 deletions lowfat/templates/lowfat/alert.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
{% for message in messages %}
{% if message.tags == "success" %}
<div class="alert alert-success" role="alert">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
<span class="fa-solid fa-check" aria-hidden="true"></span>
{% elif message.tags == "error" %}
<div class="alert alert-danger" role="alert">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
<span class="fa-solid fa-remove" aria-hidden="true"></span>
{% else %}
<div class="alert alert-info" role="alert">
{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions lowfat/templates/lowfat/blog_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ <h1>Blog Detail (Funding Request ID: {{ blog.fund.id }})
>{{ blog.get_status_display }}</span>
{% if user.is_authenticated %}
{% if user.is_staff %}
<a title="Review" class="btn btn-outline-dark" href="{% url 'blog_review' blog.id %}" role="button"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> Review</a>
<a title="Review" class="btn btn-outline-dark" href="{% url 'blog_review' blog.id %}" role="button"><span class="fa-solid fa-check" aria-hidden="true"></span> Review</a>
{% endif %}
{% if user.is_staff or blog.status == "U" %}
<a title="Edit" class="btn btn-outline-dark" href="{% url 'blog_edit' blog.id %}" role="button"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Edit</a>
<a title="Remove" class="btn btn-outline-dark" href="{% url 'blog_remove' blog.id %}?next={% url 'dashboard' %}" role="button"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Remove</a>
<a title="Edit" class="btn btn-outline-dark" href="{% url 'blog_edit' blog.id %}" role="button"><span class="fa-solid fa-edit" aria-hidden="true"></span> Edit</a>
<a title="Remove" class="btn btn-outline-dark" href="{% url 'blog_remove' blog.id %}?next={% url 'dashboard' %}" role="button"><span class="fa-solid fa-remove" aria-hidden="true"></span> Remove</a>
{% endif %}
{% endif %}
</h1>
Expand All @@ -38,7 +38,7 @@ <h1>Blog Detail (Funding Request ID: {{ blog.fund.id }})
<td>
{% for author in blog.coauthor.all %}
{{ author.fullname_link|safe }}
<a class="icon" href="mailto:{{ author.email }}"><i class="fas fa-envelope" aria-hidden="true"></i></a>{% if not forloop.last %}, {% endif %}
<a class="icon" href="mailto:{{ author.email }}"><i class="fa-solid fa-envelope" aria-hidden="true"></i></a>{% if not forloop.last %}, {% endif %}
{% endfor %}
</td>
</tr>
Expand Down
6 changes: 3 additions & 3 deletions lowfat/templates/lowfat/blog_review.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<h1>
Blog Review (Funding Request ID: {{ blog.fund.id }})
{% if user.is_staff %}
<a title="View" class="btn btn-outline-dark" href="{% url 'blog_detail' blog.id %}" role="button"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> View</a>
<a title="View" class="btn btn-outline-dark" href="{% url 'blog_detail' blog.id %}" role="button"><span class="fa-solid fa-eye" aria-hidden="true"></span> View</a>
{% endif %}
{% if user.is_staff %}
<a title="Edit" class="btn btn-outline-dark" href="{% url 'blog_edit' blog.id %}" role="button"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Edit</a>
<a title="Remove" class="btn btn-outline-dark" href="{% url 'blog_remove' blog.id %}" role="button"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Remove</a>
<a title="Edit" class="btn btn-outline-dark" href="{% url 'blog_edit' blog.id %}" role="button"><span class="fa-solid fa-edit" aria-hidden="true"></span> Edit</a>
<a title="Remove" class="btn btn-outline-dark" href="{% url 'blog_remove' blog.id %}" role="button"><span class="fa-solid fa-remove" aria-hidden="true"></span> Remove</a>
{% endif %}
</h1>
<iframe class="blog-review-html" src="{{ blog.draft_url }}">
Expand Down
26 changes: 13 additions & 13 deletions lowfat/templates/lowfat/blogs.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ <h2>
<tbody>
<tr>
{% if user.is_staff or claimant and user == claimant.user or fund.claimant and user == fund.claimant.user %}
{% if user.is_staff or claimant and user == claimant.user %}
<th>
ID
</th>
{% endif %}
<th>
Submitted date
</th>
Expand All @@ -52,11 +57,6 @@ <h2>
Funding Request
</th>
{% endif %}
{% if user.is_staff or claimant and user == claimant.user %}
<th>
ID
</th>
{% endif %}
{% if user.is_staff or claimant and user == claimant.user or fund.claimant and user == fund.claimant.user %}
<th>
Status
Expand Down Expand Up @@ -84,6 +84,9 @@ <h2>
{% endif %}
{% endif %}
>
{% if user.is_staff or claimant and user == claimant.user %}
<td>{{blog.fund.id}}</td>
{% endif %}
{% if user.is_staff or claimant and user == claimant.user or fund.claimant and user == fund.claimant.user %}
<td sorttable_customkey="{{ blog.added | date:'Ymd' }}">
{{ blog.added }}
Expand Down Expand Up @@ -115,9 +118,6 @@ <h2>
{% endif %}
</td>
{% endif %}
{% if user.is_staff or claimant and user == claimant.user %}
<td>{{blog.fund.id}}</td>
{% endif %}
{% if user.is_staff or claimant and user == claimant.user or fund.claimant and user == fund.claimant.user %}
<td>
{{ blog.get_status_display }}
Expand All @@ -138,15 +138,15 @@ <h2>
{% if user.is_staff or claimant and user == claimant.user or fund.claimant and user == fund.claimant.user %}
<td>
{% if user.is_staff %}
<a class="icon" href="mailto:{{ blog.author.email }}"><i class="fas fa-envelope" aria-hidden="true"></i></a>
<a class="icon" href="mailto:{{ blog.author.email }}"><i class="fa-solid fa-envelope" aria-hidden="true"></i></a>
{% endif %}
<a title="View" href="{% url 'blog_detail' blog.id %}"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></a>
<a title="View" href="{% url 'blog_detail' blog.id %}"><span class="fa-solid fa-eye" aria-hidden="true"></span></a>
{% if user.is_staff %}
<a title="Review" href="{% url 'blog_review' blog.id %}"><span class="glyphicon glyphicon-check" aria-hidden="true"></span></a>
<a title="Review" href="{% url 'blog_review' blog.id %}"><span class="fa-solid fa-check" aria-hidden="true"></span></a>
{% endif %}
{% if user.is_staff or blog.status == "U" %}
<a title="Edit" href="{% url 'blog_edit' blog.id %}"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></a>
<a title="Remove" href="{% url 'blog_remove' blog.id %}?next={{ request.path }}"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a>
<a title="Edit" href="{% url 'blog_edit' blog.id %}"><span class="fa-solid fa-edit" aria-hidden="true"></span></a>
<a title="Remove" href="{% url 'blog_remove' blog.id %}?next={{ request.path }}"><span class="fa-solid fa-remove" aria-hidden="true"></span></a>
{% endif %}
</td>
{% endif %}
Expand Down
6 changes: 3 additions & 3 deletions lowfat/templates/lowfat/expense_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ <h1>Expense Detail (Funding Request ID: {{ expense.fund.id }})
>{{ expense.get_status_display }}</span>
{% if user.is_authenticated %}
{% if user.is_staff %}
<a title="Review" class="btn btn-outline-dark" href="{% url 'expense_review_relative' expense.fund.id expense.relative_number %}" role="button"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> Review</a>
<a title="Review" class="btn btn-outline-dark" href="{% url 'expense_review_relative' expense.fund.id expense.relative_number %}" role="button"><span class="fa-solid fa-check" aria-hidden="true"></span> Review</a>
{% endif %}
{% if user.is_staff or expense.status in "SC" %}
<a title="Edit" class="btn btn-outline-dark" href="{% url 'expense_edit_relative' expense.fund.id expense.relative_number %}"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Edit</a>
<a title="Remove" class="btn btn-outline-dark" href="{% url 'expense_remove_relative' expense.fund.id expense.relative_number %}?next={% url 'dashboard' %}"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Remove</a>
<a title="Edit" class="btn btn-outline-dark" href="{% url 'expense_edit_relative' expense.fund.id expense.relative_number %}"><span class="fa-solid fa-edit" aria-hidden="true"></span> Edit</a>
<a title="Remove" class="btn btn-outline-dark" href="{% url 'expense_remove_relative' expense.fund.id expense.relative_number %}?next={% url 'dashboard' %}"><span class="fa-solid fa-remove" aria-hidden="true"></span> Remove</a>
{% endif %}
{% endif %}
</h1>
Expand Down
6 changes: 3 additions & 3 deletions lowfat/templates/lowfat/expense_review.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<h1>
Expense Review (Funding Request ID: {{ expense.fund.id }})
{% if user.is_staff %}
<a title="View" class="btn btn-outline-dark" href="{% url 'expense_detail_relative' expense.fund.id expense.relative_number %}" role="button"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> View</a>
<a title="Edit" class="btn btn-outline-dark" href="{% url 'expense_edit_relative' expense.fund.id expense.relative_number %}" role="button"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Edit</a>
<a title="Remove" class="btn btn-outline-dark" href="{% url 'expense_remove_relative' expense.fund.id expense.relative_number %}" role="button"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Remove</a>
<a title="View" class="btn btn-outline-dark" href="{% url 'expense_detail_relative' expense.fund.id expense.relative_number %}" role="button"><span class="fa-solid fa-eye" aria-hidden="true"></span> View</a>
<a title="Edit" class="btn btn-outline-dark" href="{% url 'expense_edit_relative' expense.fund.id expense.relative_number %}" role="button"><span class="fa-solid fa-edit" aria-hidden="true"></span> Edit</a>
<a title="Remove" class="btn btn-outline-dark" href="{% url 'expense_remove_relative' expense.fund.id expense.relative_number %}" role="button"><span class="fa-solid fa-remove" aria-hidden="true"></span> Remove</a>
{% endif %}
</h1>

Expand Down
26 changes: 13 additions & 13 deletions lowfat/templates/lowfat/expenses.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ <h2>
<table class="table table-bordered sortable">
<tbody>
<tr>
{% if user.is_staff or claimant and user == claimant.user %}
<th>
ID
</th>
{% endif %}
{% if user.is_staff or claimant and user == claimant.user %}
<th>
Submitted date
Expand All @@ -52,11 +57,6 @@ <h2>
Funding Request
</th>
{% endif %}
{% if user.is_staff or claimant and user == claimant.user %}
<th>
ID
</th>
{% endif %}
<th>
Status
</th>
Expand Down Expand Up @@ -84,6 +84,9 @@ <h2>
{% endif %}
>
{% if user.is_staff or claimant and user == claimant.user %}
<td>{{expense.fund.id}}</td>
{% endif %}
{% if user.is_staff or claimant and user == claimant.user %}
<td sorttable_customkey="{{ expense.added | date:'Ymd' }}">
{{ expense.added }}
</td>
Expand Down Expand Up @@ -111,9 +114,6 @@ <h2>
<a title='View' href="{% url 'fund_detail' expense.fund.id %}">{{ expense.fund.title }}</a>
</td>
{% endif %}
{% if user.is_staff or claimant and user == claimant.user %}
<td>{{expense.fund.id}}</td>
{% endif %}
<td>
{{ expense.get_status_display }}
{% if fund.status == 'F' %}
Expand All @@ -130,15 +130,15 @@ <h2>
{% if user.is_staff or claimant and user == claimant.user or fund.claimant and user == fund.claimant.user %}
<td>
{% if user.is_staff %}
<a class="icon" href="mailto:{{ expense.fund.claimant.email }}"><i class="fas fa-envelope" aria-hidden="true"></i></a>
<a class="icon" href="mailto:{{ expense.fund.claimant.email }}"><i class="fa-solid fa-envelope" aria-hidden="true"></i></a>
{% endif %}
<a title="View" href="{% url 'expense_detail_relative' expense.fund.id expense.relative_number %}"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></a>
<a title="View" href="{% url 'expense_detail_relative' expense.fund.id expense.relative_number %}"><span class="fa-solid fa-eye" aria-hidden="true"></span></a>
{% if user.is_staff %}
<a title="Review" href="{% url 'expense_review_relative' expense.fund.id expense.relative_number %}"><span class="glyphicon glyphicon-check" aria-hidden="true"></span></a>
<a title="Review" href="{% url 'expense_review_relative' expense.fund.id expense.relative_number %}"><span class="fa-solid fa-check" aria-hidden="true"></span></a>
{% endif %}
{% if user.is_staff or expense.status in "SC" %}
<a title="Edit" href="{% url 'expense_edit_relative' expense.fund.id expense.relative_number %}"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></a>
<a title="Remove" href="{% url 'expense_remove_relative' expense.fund.id expense.relative_number %}?next={{ request.path }}"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a>
<a title="Edit" href="{% url 'expense_edit_relative' expense.fund.id expense.relative_number %}"><span class="fa-solid fa-edit" aria-hidden="true"></span></a>
<a title="Remove" href="{% url 'expense_remove_relative' expense.fund.id expense.relative_number %}?next={{ request.path }}"><span class="fa-solid fa-remove" aria-hidden="true"></span></a>
</td>
{% endif %}
{% endif %}
Expand Down
Loading

0 comments on commit 76c30e9

Please sign in to comment.