Skip to content
Snippets Groups Projects
Commit 2ff0b9fb authored by Ryan Senior's avatar Ryan Senior
Browse files

Sort column dimension_options numerically

parent c3fed41f
No related branches found
No related tags found
No related merge requests found
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
updated-table))) updated-table)))
(def ^:private dimension-options (def ^:private dimension-options
(zipmap (map str (range)) (zipmap (range)
(concat (concat
(map (fn [[name param]] (map (fn [[name param]]
{:name name {:name name
...@@ -109,19 +109,22 @@ ...@@ -109,19 +109,22 @@
["Quantized by the 100 equally sized bins" ["num-bins" 100]]])))) ["Quantized by the 100 equally sized bins" ["num-bins" 100]]]))))
(def ^:private dimension-options-for-response (def ^:private dimension-options-for-response
(m/map-vals #(dissoc % :type) dimension-options)) (m/map-kv (fn [k v]
[(str k) (dissoc v :type)]) dimension-options))
(def ^:private datetime-dimension-indexes (def ^:private datetime-dimension-indexes
(->> dimension-options (->> dimension-options
(m/filter-kv (fn [k v] (isa? (:type v) :type/DateTime))) (m/filter-kv (fn [k v] (isa? (:type v) :type/DateTime)))
keys keys
sort)) sort
(map str)))
(def ^:private numeric-dimension-indexes (def ^:private numeric-dimension-indexes
(->> dimension-options (->> dimension-options
(m/filter-kv (fn [k v] (isa? (:type v) :type/Numeric))) (m/filter-kv (fn [k v] (isa? (:type v) :type/Numeric)))
keys keys
sort)) sort
(map str)))
(defn- assoc-dimension-options [resp] (defn- assoc-dimension-options [resp]
(-> resp (-> resp
......
...@@ -284,7 +284,7 @@ ...@@ -284,7 +284,7 @@
"Spiros Teofil" "Spiros Teofil"
"Szymon Theutrich"]} "Szymon Theutrich"]}
:created_at $})) :created_at $}))
((user->client :rasta) :get 200 (format "table/%d/query_metadata?include_sensitive_fields=true" (id :users)))) #spy/d ((user->client :rasta) :get 200 (format "table/%d/query_metadata?include_sensitive_fields=true" (id :users))))
;;; GET api/table/:id/query_metadata ;;; GET api/table/:id/query_metadata
;;; Make sure that getting the User table does *not* include password info ;;; Make sure that getting the User table does *not* include password info
...@@ -484,3 +484,11 @@ ...@@ -484,3 +484,11 @@
:raw_table_id $ :raw_table_id $
:created_at $}))}))}]) :created_at $}))}))}])
((user->client :rasta) :get 200 (format "table/%d/fks" (id :users)))) ((user->client :rasta) :get 200 (format "table/%d/fks" (id :users))))
(expect
(map str (sort (map #(Long/parseLong %) (var-get datetime-dimension-indexes))))
(var-get datetime-dimension-indexes))
(expect
(map str (sort (map #(Long/parseLong %) (var-get numeric-dimension-indexes))))
(var-get numeric-dimension-indexes))
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