Untitled

 avatar
unknown
plain_text
a year ago
1.1 kB
6
Indexable
def get_existing_tests_status_summary(self):
        queue_result = self.db.execute_dql_query(
            f"SELECT COUNT(*)"
            f" FROM {WORKFLOW_TABLE_NAME}"
            f" WHERE {WORKFLOW_COLUMNS['status'][0]} = 'QUEUE';"
        )["results"][0][0]

        scheduled_result = self.db.execute_dql_query(
            f"SELECT COUNT(*)"
            f" FROM {WORKFLOW_TABLE_NAME}"
            f" WHERE {WORKFLOW_COLUMNS['status'][0]} = 'SCHEDULED';"
        )["results"][0][0]

        starting_result = self.db.execute_dql_query(
            f"SELECT COUNT(*)"
            f" FROM {WORKFLOW_TABLE_NAME}"
            f" WHERE {WORKFLOW_COLUMNS['status'][0]} = 'STARTING';"
        )["results"][0][0]

        in_progress_result = self.db.execute_dql_query(
            f"SELECT COUNT(*)"
            f" FROM {WORKFLOW_TABLE_NAME}"
            f" WHERE {WORKFLOW_COLUMNS['status'][0]} = 'IN_PROGRESS';"
        )["results"][0][0]

        return queue_result, scheduled_result, starting_result, in_progress_result

Simplify these 4 queries into one
Editor is loading...
Leave a Comment