Skip to content

Commit

Permalink
fix allocationuser table
Browse files Browse the repository at this point in the history
  • Loading branch information
claire-peters committed Nov 16, 2023
1 parent 7944b3a commit bd87984
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,11 @@ <h3 class="d-inline"><i class="fas fa-users" aria-hidden="true"></i> Users in Al
{% else %}
<td>{{user.usage_bytes|div:allocation.usage_exact|mul:100|floatformat:2 }}%</td>
{% endif %}
{% cost_bytes user.usage_bytes as cost %}
{% if "Cluster" in allocation.get_parent_resource.resource_type.name %}
{% cost_cpuhours user.usage as cost %}
{% else %}
{% cost_bytes user.usage_bytes as cost %}
{% endif %}
{% if cost %}
<td>{{ cost }}</td>
{% endif %}
Expand Down
7 changes: 7 additions & 0 deletions coldfront/core/utils/templatetags/fasrc_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ def cost_tb(context, amount):
if a_price:
return "${:,.2f}".format(a_price * amount)
return None

@register.simple_tag(takes_context=True)
def cost_cpuhours(context, amount):
a_price = get_resource_rate(context['allocation'].get_resources_as_string)
if a_price:
return "${:,.2f}".format(a_price * amount)
return None

0 comments on commit bd87984

Please sign in to comment.