Skip to content
Snippets Groups Projects
Commit 50db36b4 authored by Simon Belak's avatar Simon Belak
Browse files

Make linter happy

parent ac68b0ab
Branches
Tags
No related merge requests found
......@@ -6,6 +6,7 @@
[comparison :as magic.comparison]]
[metabase.models
[dashboard :refer [Dashboard]]
[metric :refer [Metric]]
[segment :refer [Segment]]
[table :refer [Table]]]
[toucan.db :as db]))
......@@ -25,7 +26,6 @@
[id]
[(magic/automagic-dashboard (Table id))])
(api/defendpoint GET "/analize/metric/:id"
"Create an automagic dashboard analyzing metric with id `id`."
[id]
......
......@@ -2,8 +2,7 @@
(:require [metabase.api
[common :as api]
[card :as card.api]]
[metabase.automagic-dashboards
[populate :as populate]]
[metabase.automagic-dashboards.populate :as populate]
[metabase.models
[card :refer [Card]]
[dashboard :as dashboard :refer [Dashboard]]
......@@ -78,6 +77,8 @@
[card]))
(defn comparison-dashboard
"Create a comparison dashboard based on dashboard `dashboard` comparing subsets of
the dataset defined by filter expressions `left` and `right`."
[dashboard left right]
(let [cards (->> dashboard dashboard->cards (mapcat unroll-multiseries))
dashboard (db/insert! Dashboard
......@@ -86,15 +87,16 @@
(:name right))
:description (format "Automatically generated comparison dashboard comparing segments %s and %s" (:name left) (:name right))
:creator_id api/*current-user-id*
:parameters [])]
:parameters [])
;; Binding return value to make linter happy
_ (reduce (fn [row [left right]]
(place-row! dashboard row (:height left)
(clone-card! left)
(clone-card! right)))
title-height
(map (juxt (partial inject-segment left)
(partial inject-segment right))
cards))]
(add-col-title! dashboard (:name left) 0)
(add-col-title! dashboard (:name right) (/ populate/grid-width 2))
(reduce (fn [row [left right]]
(place-row! dashboard row (:height left)
(clone-card! left)
(clone-card! right)))
title-height
(map (juxt (partial inject-segment left)
(partial inject-segment right))
cards))
(add-col-title! dashboard (:name right) (/ populate/grid-width 2))
dashboard))
......@@ -56,6 +56,7 @@
card))
(defn- add-card!
"Add a card to dashboard `dashboard` at position [`x`, `y`]."
[dashboard card [x y]]
(dashboard/add-dashcard! dashboard (create-card! card)
{:col y
......@@ -64,6 +65,7 @@
:sizeY (:height card)}))
(defn add-text-card!
"Add a text card to dashboard `dashboard` at position [`x`, `y`]."
[dashboard {:keys [text width height]} [x y]]
(dashboard/add-dashcard! dashboard nil
{:creator_id api/*current-user-id*
......@@ -77,7 +79,7 @@
:sizeX width
:sizeY height}))
(def ^:private ^Integer max-cards 9)
(def ^:private ^Long max-cards 9)
(defn- make-grid
[width height]
......
......@@ -136,4 +136,5 @@
(remove zero?)
(map #(* % (math/log %))))
+
0.0
(pdf histogram))))
......@@ -126,7 +126,6 @@
(derive :type/City :type/Category)
(derive :type/State :type/Category)
(derive :type/Country :type/Category)
(derive :type/Name :type/Category)
(derive :type/User :type/*)
(derive :type/Author :type/User)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment