From 1feb52e776693f7ef71adc99dea67300b90b00d7 Mon Sep 17 00:00:00 2001
From: Howon Lee <hlee.howon@gmail.com>
Date: Tue, 19 Oct 2021 13:48:12 -0700
Subject: [PATCH] Coalesce audit question query runs to be 0 if no query
 executions (#18559)

Null query runs show up at the top previously. This is because they are a null set. This is a thing that there is an affordance to happen, because you can just create cards without running them in the notebook builder. Coalesces the null to 0 to make things sort right.
---
 .../backend/src/metabase_enterprise/audit_app/pages/queries.clj | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/enterprise/backend/src/metabase_enterprise/audit_app/pages/queries.clj b/enterprise/backend/src/metabase_enterprise/audit_app/pages/queries.clj
index 45b0c5ed20d..5f508f03132 100644
--- a/enterprise/backend/src/metabase_enterprise/audit_app/pages/queries.clj
+++ b/enterprise/backend/src/metabase_enterprise/audit_app/pages/queries.clj
@@ -195,7 +195,7 @@
                              :card.cache_ttl
                              [:avg_exec_time_45.avg_running_time_ms :avg_exec_time]
                              [:total_runtime_45.total_running_time_ms :total_runtime]
-                             [:query_runs.count :query_runs]
+                             [(common/zero-if-null :query_runs.count) :query_runs]
                              [(common/card-public-url :card.public_uuid) :public_link]]
                  :from      [[:report_card :card]]
                  :left-join [[:collection :coll]      [:= :card.collection_id :coll.id]
-- 
GitLab