Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
a078060a
Commit
a078060a
authored
9 years ago
by
Allen Gilliland
Browse files
Options
Downloads
Patches
Plain Diff
manually back porting the fix from #1830 to the 0.14.0 release branch.
parent
dc46bca9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/metabase/pulse.clj
+17
-10
17 additions, 10 deletions
src/metabase/pulse.clj
with
17 additions
and
10 deletions
src/metabase/pulse.clj
+
17
−
10
View file @
a078060a
(
ns
metabase.pulse
(
:require
[
clojure.java.io
:as
io
]
(
clojure
[
pprint
:refer
[
cl-format
]]
[
stacktrace
:refer
[
print-stack-trace
]]
[
string
:refer
[
upper-case
]])
[
clojure.tools.logging
:as
log
]
(
clj-time
[
coerce
:as
c
]
...
...
@@ -324,12 +325,12 @@
xmin
(
apply
min
xs
)
xmax
(
apply
max
xs
)
xrange
(
-
xmax
xmin
)
xs
'
(
map
#
(
/
(
-
%
xmin
)
xrange
)
xs
)
xs
'
(
map
#
(
/
(
double
(
-
%
xmin
)
)
xrange
)
xs
)
ys
(
map
second
rows
)
ymin
(
apply
min
ys
)
ymax
(
apply
max
ys
)
yrange
(
max
1
(
-
ymax
ymin
))
; `(max 1 ...)` so we don't divide by zero
ys
'
(
map
#
(
/
(
-
%
ymin
)
yrange
)
ys
)
ys
'
(
map
#
(
/
(
double
(
-
%
ymin
)
)
yrange
)
ys
)
; cast to double to avoid "Non-terminating decimal expansion" errors
rows
'
(
reverse
(
take-last
2
rows
))
values
(
map
(
comp
format-number
second
)
rows
'
)
labels
(
format-timestamp-pair
(
map
first
rows
'
)
(
first
cols
))]
...
...
@@ -376,12 +377,17 @@
aggregation
(
->
card
:dataset_query
:query
:aggregation
first
)]
(
cond
(
or
(
=
aggregation
:rows
)
(
contains?
#
{
:pin_map
:state
:country
}
(
:display
card
)))
nil
(
zero?
row-count
)
:empty
(
and
(
=
col-count
1
)
(
=
row-count
1
))
:scalar
(
and
(
=
col-count
2
)
(
datetime-field?
col-1
)
(
number-field?
col-2
))
:sparkline
(
and
(
=
col-count
2
)
(
number-field?
col-2
))
:bar
:else
:table
)))
(
contains?
#
{
:pin_map
:state
:country
}
(
:display
card
)))
nil
(
zero?
row-count
)
:empty
(
and
(
=
col-count
1
)
(
=
row-count
1
))
:scalar
(
and
(
=
col-count
2
)
(
>
row-count
1
)
(
datetime-field?
col-1
)
(
number-field?
col-2
))
:sparkline
(
and
(
=
col-count
2
)
(
number-field?
col-2
))
:bar
:else
:table
)))
(
defn
render-pulse-card
[
card
data
render-img
include-title
include-buttons
]
...
...
@@ -415,10 +421,11 @@
:font-weight
700
})}
"We were unable to display this card."
[
:br
]
"Please view this card in Metabase."
])]
(
catch
Throwable
e
(
log/warn
(
str
"Pulse card render error:"
e
)
)
(
log/warn
"Pulse card render error:"
e
)
[
:div
{
:style
(
style
font-style
{
:color
"#EF8C8C"
:font-weight
700
})}
:font-weight
700
:padding
:16px
})}
"An error occurred while displaying this card."
])))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment