From 05a07d93b4d8647405767fb0544fb3a94ed8161e Mon Sep 17 00:00:00 2001 From: Sharad S Date: Thu, 20 Feb 2025 12:24:13 -0500 Subject: [PATCH] Update TreeRankQuery to fix implicit ORs - see: https://github.com/specify/specify7/pull/6196#issuecomment-2669749739 --- specifyweb/stored_queries/queryfieldspec.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/specifyweb/stored_queries/queryfieldspec.py b/specifyweb/stored_queries/queryfieldspec.py index bd68b4b1611..20689011f91 100644 --- a/specifyweb/stored_queries/queryfieldspec.py +++ b/specifyweb/stored_queries/queryfieldspec.py @@ -117,7 +117,16 @@ def make_stringid(fs, table_list): class TreeRankQuery(Relationship): # FUTURE: used to remember what the previous value was. Useless after 6 retires original_field: str - pass + + def __hash__(self): + return hash((TreeRankQuery, self.relatedModelName, self.name)) + + def __eq__(self, value): + return ( + isinstance(value, TreeRankQuery) + and value.name == self.name + and value.relatedModelName == self.relatedModelName + ) QueryNode = Union[Field, Relationship, TreeRankQuery]