From 0989c308d0cea9b9405a1338d257b542c6d33d73 Mon Sep 17 00:00:00 2001
From: Oliver Walters <oliver.henry.walters@gmail.com>
Date: Thu, 28 Apr 2022 01:20:36 +1000
Subject: [PATCH 1/2] Remove stat context variables

---
 InvenTree/InvenTree/views.py | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/InvenTree/InvenTree/views.py b/InvenTree/InvenTree/views.py
index feb586c844..3415a7363b 100644
--- a/InvenTree/InvenTree/views.py
+++ b/InvenTree/InvenTree/views.py
@@ -882,29 +882,6 @@ class DatabaseStatsView(AjaxView):
     ajax_template_name = "stats.html"
     ajax_form_title = _("System Information")
 
-    def get_context_data(self, **kwargs):
-
-        ctx = {}
-
-        # Part stats
-        ctx['part_count'] = Part.objects.count()
-        ctx['part_cat_count'] = PartCategory.objects.count()
-
-        # Stock stats
-        ctx['stock_item_count'] = StockItem.objects.count()
-        ctx['stock_loc_count'] = StockLocation.objects.count()
-
-        """
-        TODO: Other ideas for database metrics
-
-        - "Popular" parts (used to make other parts?)
-        - Most ordered part
-        - Most sold part
-        - etc etc etc
-        """
-
-        return ctx
-
 
 class NotificationsView(TemplateView):
     """ View for showing notifications

From ec68cf397d68f1c667452faa73a6fb4d4162257a Mon Sep 17 00:00:00 2001
From: Oliver Walters <oliver.henry.walters@gmail.com>
Date: Thu, 28 Apr 2022 01:21:05 +1000
Subject: [PATCH 2/2] Revert "Remove stat context variables"

This reverts commit 0989c308d0cea9b9405a1338d257b542c6d33d73.
---
 InvenTree/InvenTree/views.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/InvenTree/InvenTree/views.py b/InvenTree/InvenTree/views.py
index 3415a7363b..feb586c844 100644
--- a/InvenTree/InvenTree/views.py
+++ b/InvenTree/InvenTree/views.py
@@ -882,6 +882,29 @@ class DatabaseStatsView(AjaxView):
     ajax_template_name = "stats.html"
     ajax_form_title = _("System Information")
 
+    def get_context_data(self, **kwargs):
+
+        ctx = {}
+
+        # Part stats
+        ctx['part_count'] = Part.objects.count()
+        ctx['part_cat_count'] = PartCategory.objects.count()
+
+        # Stock stats
+        ctx['stock_item_count'] = StockItem.objects.count()
+        ctx['stock_loc_count'] = StockLocation.objects.count()
+
+        """
+        TODO: Other ideas for database metrics
+
+        - "Popular" parts (used to make other parts?)
+        - Most ordered part
+        - Most sold part
+        - etc etc etc
+        """
+
+        return ctx
+
 
 class NotificationsView(TemplateView):
     """ View for showing notifications