summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
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:39:22 +0100
commit3adbd561ced57cb9c950af2d6d7d25f57f8799e0 (patch)
treee2301ff31a54062c731a60774e088f073d6a89cf /archaeological_operations
parent6468fa4c22b5ec2c30b450a5d0f8cc005d01f4be (diff)
downloadIshtar-3adbd561ced57cb9c950af2d6d7d25f57f8799e0.tar.bz2
Ishtar-3adbd561ced57cb9c950af2d6d7d25f57f8799e0.zip
🚑️ fix huge performance problems on permissions when too many items are attached
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/models.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 9119a5c72..42325d8be 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -856,32 +856,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
@@ -2294,18 +2301,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