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
772bdb6f
Unverified
Commit
772bdb6f
authored
5 years ago
by
Simon Belak
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
x-rays: harden against incomplete fingerprints (#11698)
parent
e5095d40
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/automagic_dashboards/core.clj
+15
-14
15 additions, 14 deletions
src/metabase/automagic_dashboards/core.clj
with
15 additions
and
14 deletions
src/metabase/automagic_dashboards/core.clj
+
15
−
14
View file @
772bdb6f
...
...
@@ -279,20 +279,21 @@
(
defn-
optimal-datetime-resolution
[
field
]
(
if-let
[[
earliest
latest
]
(
some->>
field
:fingerprint
:type
:type/DateTime
((
juxt
:earliest
:latest
))
(
map
u.date/parse
))]
;; e.g. if 3 hours > [duration between earliest and latest] then use `:minute` resolution
(
condp
u.date/greater-than-period-duration?
(
u.date/period-duration
earliest
latest
)
(
t/hours
3
)
:minute
(
t/days
7
)
:hour
(
t/months
6
)
:day
(
t/years
10
)
:month
:year
)
:day
))
(
let
[[
earliest
latest
]
(
some->>
field
:fingerprint
:type
:type/DateTime
((
juxt
:earliest
:latest
))
(
map
u.date/parse
))]
(
if
(
and
earliest
latest
)
;; e.g. if 3 hours > [duration between earliest and latest] then use `:minute` resolution
(
condp
u.date/greater-than-period-duration?
(
u.date/period-duration
earliest
latest
)
(
t/hours
3
)
:minute
(
t/days
7
)
:hour
(
t/months
6
)
:day
(
t/years
10
)
:month
:year
)
:day
)))
(
defmethod
->reference
[
:mbql
(
type
Field
)]
[
_
{
:keys
[
fk_target_field_id
id
link
aggregation
name
base_type
]
:as
field
}]
...
...
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