From ddc9e839ff1c185801ba922542b468a015c76767 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 28 Jan 2025 17:17:29 +0100 Subject: 🚑️ sheet warehouse: deactivate statistics when too many containers are attached MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_warehouse/models.py | 1 + archaeological_warehouse/templates/ishtar/sheet_warehouse.html | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 67af4b5e0..3cb04816d 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -220,6 +220,7 @@ class DivisionContainer(DashboardFormItem): def _number_of_items_by_place(self, model, division_key, count_filter=None): res = {} + # TODO v5: optimize cf. Les Milles DRASSM paths = self.available_division_tuples[:] for path in paths: cpath = [] diff --git a/archaeological_warehouse/templates/ishtar/sheet_warehouse.html b/archaeological_warehouse/templates/ishtar/sheet_warehouse.html index d82b0ee6c..76a419e78 100644 --- a/archaeological_warehouse/templates/ishtar/sheet_warehouse.html +++ b/archaeological_warehouse/templates/ishtar/sheet_warehouse.html @@ -171,6 +171,12 @@ role="tabpanel" aria-labelledby="{{window_id}}-stats-tab">

{% trans "Statistics" %}

+ {% if item.number_containers > 1000 or item.number_divisions > 200 %} +
+ +  {% trans "Statistics disabled when too many containers are attached to a warehouse. In a future version, statistics will be optimized." %} +
+ {% else %}
{% if display_documents %}