From 42dea337c95215e41f7e94f4561e0db2a12b0983 Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Mon, 12 Apr 2021 09:35:01 +0000 Subject: [PATCH] #141: Change function to fetch distinct attributes - I haven't deleted the original function yet, but it's very likely I will at the end of this work as there are no other calls to that function --- datagateway_api/common/icat/query.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/datagateway_api/common/icat/query.py b/datagateway_api/common/icat/query.py index 9d99e9e2..231afc3c 100644 --- a/datagateway_api/common/icat/query.py +++ b/datagateway_api/common/icat/query.py @@ -92,7 +92,7 @@ def execute_query(self, client, return_json_formattable=False): if self.query.aggregate == "DISTINCT" and not count_query: log.info("Extracting the distinct fields from query's conditions") # Check query's conditions for the ones created by the distinct filter - distinct_attributes = self.iterate_query_conditions_for_distinctiveness() + distinct_attributes = self.get_distinct_attributes() if distinct_attributes != []: mapped_distinct_fields = self.map_distinct_attributes_to_entity_names( distinct_attributes, flat_query_includes, @@ -121,6 +121,9 @@ def execute_query(self, client, return_json_formattable=False): log.info("Query results will be returned as ICAT entities") return query_result + def get_distinct_attributes(self): + return self.query.attributes + def iterate_query_conditions_for_distinctiveness(self): distinct_attributes = [] for attribute_name, where_statement in self.query.conditions.items():