From 7e95c0f530a0750e9ae90de119f3b43508879666 Mon Sep 17 00:00:00 2001 From: Sameer Al-Sakran <sameer@expa.com> Date: Fri, 25 Nov 2016 12:52:20 -0800 Subject: [PATCH] add instance start date --- src/metabase/util/stats.clj | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/metabase/util/stats.clj b/src/metabase/util/stats.clj index 245ed402cdb..6ec03fbd309 100644 --- a/src/metabase/util/stats.clj +++ b/src/metabase/util/stats.clj @@ -104,7 +104,11 @@ "return a histogram for large numbers" (partial histogram bin-large-number)) - +(defn instance-start-date? + "Pull up the first user account and use that date" + [] + ((first (db/select 'User {:limit 1} {:order-by [[:date_joined :desc]]})) :date_joined) + ) (defn- get-settings "Figure out global info aboutt his instance" @@ -119,7 +123,7 @@ :email_configured ((resolve 'metabase.email/email-configured?)) :slack_configured ((resolve 'metabase.integrations.slack/slack-configured?)) :sso_configured (not (nil? metabase.api.session/google-auth-client-id)) - :instance_started (new java.util.Date) ;; HOW DO I GET THIS? + :instance_started instance-start-date? :has_sample_data (db/exists? 'Database, :is_sample true) } ) -- GitLab