Skip to content

Commit

Permalink
fix center_summary display, add logging message formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
claire-peters committed Jan 30, 2024
1 parent 996e375 commit 1487bf3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions coldfront/config/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
'handlers': {
'console': {
'class': 'logging.StreamHandler',
"format": "[{server_time}] {name} {levelname} {message}",
"style": "{",
},
'django-q': {
'class': 'logging.handlers.TimedRotatingFileHandler',
Expand Down
5 changes: 4 additions & 1 deletion coldfront/core/portal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ def center_summary(request):

allocation_sizes = [float(allocation.size) for allocation in resource_allocations if allocation.size]
# volume['avgsize'] = allocation_sizes
volume['avgsize'] = round(sum(allocation_sizes)/len(allocation_sizes), 2)
try:
volume['avgsize'] = round(sum(allocation_sizes)/len(allocation_sizes), 2)
except ZeroDivisionError:
volume['avgsize'] = 0

project_ids = set(resource_allocations.values_list('project'))
volume['lab_count'] = len(project_ids)
Expand Down

0 comments on commit 1487bf3

Please sign in to comment.