Skip to content

Commit

Permalink
update ProjectDetail user table actions display, allocation cost calc…
Browse files Browse the repository at this point in the history
…ulation
  • Loading branch information
claire-peters committed Aug 21, 2024
1 parent 535705f commit 4f6be66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions coldfront/core/allocation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,10 @@ def cost(self):
size_attr_name = self._return_size_attr_name()
if not size_attr_name:
return None
size = self.allocationattribute_set.get(
allocation_attribute_type__name=size_attr_name).value
return 0 if not size else price * float(size)
size = self.allocationattribute_set.filter(
allocation_attribute_type__name=size_attr_name)
size_value = None if not size else size.first().value
return 0 if not size_value else price * float(size_value)

@property
def expires_in(self):
Expand Down
12 changes: 7 additions & 5 deletions coldfront/core/project/templates/project/project_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ <h3 class="d-inline" id="users"><i class="fas fa-users" aria-hidden="true"></i>
<i class="fas fa-info-circle" aria-hidden="true"></i>
</a>
</th>
<th scope="col">Actions</th>
{% if is_allowed_to_update_permissions %}
<th scope="col">Actions</th>
{% endif %}
</tr>
</thead>
<tbody>
Expand All @@ -347,8 +349,8 @@ <h3 class="d-inline" id="users"><i class="fas fa-users" aria-hidden="true"></i>
<td>{{ user.user.first_name }} {{ user.user.last_name }}</td>
<td>{{ user.user.email }}</td>
<td>{{ user.role.name }}</td>
<td>
{% if is_allowed_to_update_permissions %}
{% if is_allowed_to_update_permissions %}
<td>
<input type="checkbox"
id="email_notifications_for_user_id_{{user.id}}"
name="email_notifications_checkbox"
Expand All @@ -368,8 +370,8 @@ <h3 class="d-inline" id="users"><i class="fas fa-users" aria-hidden="true"></i>
value="{{ user.enable_notifications }}"
{% if user.enable_notifications %} checked {% endif %}
disabled>
{% endif %}
</td>
</td>
{% endif %}
<td>
{% if is_allowed_to_update_permissions and user != project.pi %}
<a href="{% url 'project-user-detail' project.pk user.id %}"><i class="fas fa-user-edit" aria-hidden="true"></i><span class="sr-only">Edit</span></a>
Expand Down

0 comments on commit 4f6be66

Please sign in to comment.