From 31677c33fc0177838adcac229569e19932ba9e61 Mon Sep 17 00:00:00 2001 From: Keiran Price Date: Thu, 22 Aug 2019 08:11:22 +0100 Subject: [PATCH] #34: Add ISISInvestigationsCountQuery --- common/database_helpers.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/database_helpers.py b/common/database_helpers.py index ce1b9e97..95deb642 100644 --- a/common/database_helpers.py +++ b/common/database_helpers.py @@ -440,3 +440,12 @@ def get_investigations_for_user(user_id, filters): finally: query.session.close() + +class ISISInvestigationsCountQuery(CountQuery): + """ + The query class used for /users/<:id>/investigations/count + """ + + def __init__(self, user_id): + super().__init__(INVESTIGATIONUSER) + self.base_query = self.base_query.join(INVESTIGATION).filter(INVESTIGATIONUSER.USER_ID == user_id)