From 692ac0f4c0013dba60263634d1b7598924f227e5 Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Wed, 30 Sep 2020 13:59:52 +0000 Subject: [PATCH] #145: Fix bug on non-count queries --- common/icat/helpers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/icat/helpers.py b/common/icat/helpers.py index 13c7f3b8..35ac65b5 100644 --- a/common/icat/helpers.py +++ b/common/icat/helpers.py @@ -164,7 +164,10 @@ def execute_query(self, client, return_json_formattable=False): # If the query has a COUNT function applied to it, some of these steps can be # skipped - count_query = True if "COUNT" in self.query.aggregate else False + count_query = False + if self.query.aggregate is not None: + if "COUNT" in self.query.aggregate: + count_query = True if self.query.aggregate == "DISTINCT" and not count_query: log.info("Extracting the distinct fields from query's conditions")