Skip to content
Snippets Groups Projects
Unverified Commit 354f152e authored by Case Nelson's avatar Case Nelson Committed by GitHub
Browse files

[MLv2] Add short-name to temporal-bucket display-info (#34225)

parent c13328df
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@
[metabase.lib.schema.temporal-bucketing
:as lib.schema.temporal-bucketing]
[metabase.shared.util.i18n :as i18n]
[metabase.util :as u]
[metabase.util.malli :as mu]))
(mu/defn describe-temporal-unit :- :string
......@@ -195,7 +196,8 @@
(defmethod lib.metadata.calculation/display-info-method :option/temporal-bucketing
[query stage-number option]
(merge {:display-name (lib.metadata.calculation/display-name query stage-number option)}
(merge {:display-name (lib.metadata.calculation/display-name query stage-number option)
:short-name (u/qualified-name (raw-temporal-bucket option))}
(select-keys option [:default :selected])))
(defmulti available-temporal-buckets-method
......
......@@ -173,3 +173,24 @@
option))
(is (= :month
(lib.temporal-bucket/raw-temporal-bucket option)))))
(deftest ^:parallel short-name-display-info-test
(let [query lib.tu/venues-query]
(is (= #{"minute"
"hour"
"day"
"week"
"month"
"quarter"
"year"
"minute-of-hour"
"hour-of-day"
"day-of-week"
"day-of-month"
"day-of-year"
"week-of-year"
"month-of-year"
"quarter-of-year"}
(into #{}
(map #(:short-name (lib/display-info query -1 %)))
(lib.temporal-bucket/available-temporal-buckets query (meta/field-metadata :products :created-at)))))))
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