Skip to content

Commit

Permalink
Merge pull request metabase#2113 from metabase/fix-pulse-rendering-er…
Browse files Browse the repository at this point in the history
…rors

Fix pulse rendering errors
  • Loading branch information
agilliland committed Mar 9, 2016
2 parents 1edd555 + 9c166ff commit 50d2e66
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/metabase/pulse.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
[core :as t]
[format :as f])
[hiccup.core :refer [html h]]
[metabase.util.urls :as urls])
[metabase.util.urls :as urls]
[metabase.util :as u])
(:import (java.awt BasicStroke Color Dimension RenderingHints)
java.awt.image.BufferedImage
(java.io ByteArrayInputStream ByteArrayOutputStream)
Expand Down Expand Up @@ -150,7 +151,7 @@
(defn- format-cell
[value col]
(cond
(instance? Date value) (format-timestamp (.getTime ^Date value) col)
(datetime-field? col) (format-timestamp (.getTime ^Date (u/->Timestamp value)) col)
(and (number? value) (not (datetime-field? col))) (format-number value)
:else (str value)))

Expand Down Expand Up @@ -314,11 +315,11 @@
(.toByteArray os)))

(defn- render:sparkline
[card {:keys [rows cols]}]
[_ {:keys [rows cols]}]
(let [xs (for [row rows
:let [x (first row)]]
(if (instance? Date x)
(.getTime ^Date x)
(if (datetime-field? (first cols))
(.getTime ^Date (u/->Timestamp x))
x))
xmin (apply min xs)
xmax (apply max xs)
Expand Down

0 comments on commit 50d2e66

Please sign in to comment.