diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-03-19 11:54:38 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-03-19 12:44:45 +0100 |
commit | b0c2ded8e95dcf61b36685fec4b40d9bcf82bef0 (patch) | |
tree | 72a8ac0ec7b8c779516bd2d22bb057163b64243d /archaeological_operations/models.py | |
parent | c1fa91b2acb68aff15ca1dfbabaf51d8ea83e166 (diff) | |
download | Ishtar-b0c2ded8e95dcf61b36685fec4b40d9bcf82bef0.tar.bz2 Ishtar-b0c2ded8e95dcf61b36685fec4b40d9bcf82bef0.zip |
🚑️ fix huge performance problems on permissions when too many items are attached
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 171b60513..d933944d1 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -889,32 +889,39 @@ class ArchaeologicalSite( q = ( cls._construct_query_own( + cls, "operations__context_record__base_finds__find__container__responsible__", Warehouse._get_query_owns_dicts(ishtaruser), ) | cls._construct_query_own( + cls, "operations__context_record__base_finds__find__basket__", [{"shared_with": ishtaruser, "shared_write_with": ishtaruser}], ) | cls._construct_query_own( + cls, "operations__context_record__base_finds__find__container__location__", Warehouse._get_query_owns_dicts(ishtaruser), ) | cls._construct_query_own( + cls, "top_operations__context_record__base_finds__find__container__responsible__", Warehouse._get_query_owns_dicts(ishtaruser), ) | cls._construct_query_own( + cls, "top_operations__context_record__base_finds__find__container__location__", Warehouse._get_query_owns_dicts(ishtaruser), ) | cls._construct_query_own( + cls, "operations__", Operation._get_query_owns_dicts(ishtaruser, no_rel=True) ) | cls._construct_query_own( + cls, "top_operations__", Operation._get_query_owns_dicts(ishtaruser) ) - | cls._construct_query_own("", cls._get_query_owns_dicts(ishtaruser)) + | cls._construct_query_own(cls, "", cls._get_query_owns_dicts(ishtaruser)) ) return q @@ -2378,18 +2385,21 @@ class Operation( q = ( cls._construct_query_own( + cls, "context_record__base_finds__find__container__responsible__", Warehouse._get_query_owns_dicts(ishtaruser), ) | cls._construct_query_own( + cls, "context_record__base_finds__find__container__location__", Warehouse._get_query_owns_dicts(ishtaruser), ) | cls._construct_query_own( + cls, "context_record__base_finds__find__basket__", [{"shared_with": ishtaruser, "shared_write_with": ishtaruser}], ) - | cls._construct_query_own("", cls._get_query_owns_dicts(ishtaruser)) + | cls._construct_query_own(cls, "", cls._get_query_owns_dicts(ishtaruser)) ) return q |