Skip to content
Snippets Groups Projects
Unverified Commit 2afa0e5a authored by Cam Saul's avatar Cam Saul Committed by GitHub
Browse files

Fix error in send-abandonment-emails task (#20976)

parent 31a04629
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,7 @@
(str (deferred-trs "Metabase Enterprise Edition extensions are PRESENT.")
"\n\n"
(deferred-trs "Usage of Metabase Enterprise Edition features are subject to the Metabase Commercial License.")
" "
(deferred-trs "See {0} for details." "https://www.metabase.com/license/commercial/"))
(deferred-trs "Metabase Enterprise Edition extensions are NOT PRESENT."))))
......
......@@ -90,11 +90,17 @@
(s/defn ^:private should-send-abandoment-email?
([]
(should-send-abandoment-email?
(instance-creation-timestamp)
(db/select-one [User [:%max.date_joined :last-user]])
(db/select-one [Activity [:%max.timestamp :last-activity]])
(db/select-one [ViewLog [:%max.timestamp :last-view]])))
(let [[last-user last-activity last-view]
(map :last (db/query
{:union-all
[{:select [[:%max.date_joined :last]], :from [User]}
{:select [[:%max.timestamp :last]], :from [Activity]}
{:select [[:%max.timestamp :last]], :from [ViewLog]}]}))]
(should-send-abandoment-email?
(instance-creation-timestamp)
last-user
last-activity
last-view)))
([instance-creation :- (s/maybe Temporal)
last-user :- (s/maybe Temporal)
......
......@@ -20,6 +20,9 @@
(-> @inbox vals first count))))))
(deftest should-send-abandoment-email-test
(testing "Make sure zero-arity version works (#12068)"
(testing `(follow-up-emails/should-send-abandoment-email?)
(is (boolean? (#'follow-up-emails/should-send-abandoment-email?)))))
(testing "Conditions where abandonment emails should be sent"
(doseq [now [(t/zoned-date-time) (t/offset-date-time) (t/instant)]
instance-creation [0 1 5 nil]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment