aboutsummaryrefslogtreecommitdiffstats
path: root/layerindex/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'layerindex/views.py')
-rw-r--r--layerindex/views.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/layerindex/views.py b/layerindex/views.py
index 4f6c2c9df8..95812ca29f 100644
--- a/layerindex/views.py
+++ b/layerindex/views.py
@@ -1007,3 +1007,20 @@ class ClassicRecipeStatsView(TemplateView):
'jquery_on_ready': False,
}
return context
+
+
+class StatsView(TemplateView):
+ def get_context_data(self, **kwargs):
+ context = super(StatsView, self).get_context_data(**kwargs)
+ context['layercount'] = LayerItem.objects.count()
+ context['recipe_count_distinct'] = Recipe.objects.values('pn').distinct().count()
+ context['class_count_distinct'] = BBClass.objects.values('name').distinct().count()
+ context['machine_count_distinct'] = Machine.objects.values('name').distinct().count()
+ context['distro_count_distinct'] = Distro.objects.values('name').distinct().count()
+ context['perbranch'] = Branch.objects.order_by('sort_priority').annotate(
+ layer_count=Count('layerbranch', distinct=True),
+ recipe_count=Count('layerbranch__recipe', distinct=True),
+ class_count=Count('layerbranch__bbclass', distinct=True),
+ machine_count=Count('layerbranch__machine', distinct=True),
+ distro_count=Count('layerbranch__distro', distinct=True))
+ return context