aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraven hodgdon <jhodgdon@iol.unh.edu>2021-12-22 15:48:40 -0500
committerRaven Hodgdon <jhodgdon@iol.unh.edu>2022-03-29 14:04:12 -0400
commite3f283a3711d1b93a93c915ad668a2b01dbcbc7b (patch)
tree2a2f65163e8180697d8ac23b5a477ce26fd95163
parentb7df4193fef9adeccf99685af7d7420274d66064 (diff)
Fix for booking statistics
Signed-off-by: jhodgon <jhodgdon@iol.unh.edu> Change-Id: Id9d6df5c4df6227fdfa8ca60963b74ad85b1221f
-rw-r--r--src/api/migrations/0022_add_cifile_generated_field.py15
-rw-r--r--src/booking/stats.py1
2 files changed, 16 insertions, 0 deletions
diff --git a/src/api/migrations/0022_add_cifile_generated_field.py b/src/api/migrations/0022_add_cifile_generated_field.py
new file mode 100644
index 0000000..f83a102
--- /dev/null
+++ b/src/api/migrations/0022_add_cifile_generated_field.py
@@ -0,0 +1,15 @@
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ('api', '0018_cloudinitfile'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="CloudInitFile",
+ name="generated",
+ field=models.BooleanField(default=False)
+ ),
+ ]
diff --git a/src/booking/stats.py b/src/booking/stats.py
index 70f91fa..5a59d32 100644
--- a/src/booking/stats.py
+++ b/src/booking/stats.py
@@ -94,6 +94,7 @@ class StatisticsManager(object):
proj_count = sorted(Counter(projects).items(), key=lambda x: x[1])
project_keys = [proj[0] for proj in proj_count[-5:]]
+ project_keys = ['None' if x is None else x for x in project_keys]
project_counts = [proj[1] for proj in proj_count[-5:]]
resources = {key: [x, value] for key, value in profiles.items()}