Fix for booking statistics 27/73127/2
authorraven hodgdon <jhodgdon@iol.unh.edu>
Wed, 22 Dec 2021 20:48:40 +0000 (15:48 -0500)
committerRaven Hodgdon <jhodgdon@iol.unh.edu>
Tue, 29 Mar 2022 18:04:12 +0000 (14:04 -0400)
Signed-off-by: jhodgon <jhodgdon@iol.unh.edu>
Change-Id: Id9d6df5c4df6227fdfa8ca60963b74ad85b1221f

src/api/migrations/0022_add_cifile_generated_field.py [new file with mode: 0644]
src/booking/stats.py

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 (file)
index 0000000..f83a102
--- /dev/null
@@ -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)
+        ),
+    ]
index 70f91fa..5a59d32 100644 (file)
@@ -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()}