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
811086b5
Commit
811086b5
authored
7 years ago
by
Cam Saül
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #5406 from metabase/dont-send-archived-cards-in-pulses
Don't send/show archived cards in pulses (#5224)
parents
462cfa3c
2c88569a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/metabase/models/pulse.clj
+3
-2
3 additions, 2 deletions
src/metabase/models/pulse.clj
src/metabase/pulse.clj
+5
-3
5 additions, 3 deletions
src/metabase/pulse.clj
src/metabase/query_processor/middleware/cache.clj
+3
-3
3 additions, 3 deletions
src/metabase/query_processor/middleware/cache.clj
with
11 additions
and
8 deletions
src/metabase/models/pulse.clj
+
3
−
2
View file @
811086b5
...
...
@@ -77,6 +77,7 @@
"Return the `Cards` associated with this PULSE."
[{
:keys
[
id
]}]
(
db/select
[
Card
:id
:name
:description
:display
]
:archived
false
(
mdb/join
[
Card
:id
]
[
PulseCard
:card_id
])
(
db/qualify
PulseCard
:pulse_id
)
id
{
:order-by
[[(
db/qualify
PulseCard
:position
)
:asc
]]}))
...
...
@@ -119,7 +120,7 @@
(
db/delete!
PulseCard
:pulse_id
id
)
;; now just insert all of the cards that were given to us
(
when
(
seq
card-ids
)
(
let
[
cards
(
map-indexed
(
fn
[
i
dx
itm
]
{
:pulse_id
id
:card_id
itm
:position
i
dx
})
card-ids
)]
(
let
[
cards
(
map-indexed
(
fn
[
i
card-id
]
{
:pulse_id
id
,
:card_id
card-id,
:position
i
})
card-ids
)]
(
db/insert-many!
PulseCard
cards
))))
...
...
@@ -207,7 +208,7 @@
(
db/transaction
;; update the pulse itself
(
db/update!
Pulse
id,
:name
name,
:skip_if_empty
skip-if-empty?
)
;; update cards (only if they changed)
;; update cards (only if they changed)
. Order for the cards is important which is why we're not using select-field
(
when
(
not=
cards
(
map
:card_id
(
db/select
[
PulseCard
:card_id
]
,
:pulse_id
id,
{
:order-by
[[
:position
:asc
]]})))
(
update-pulse-cards!
pulse
cards
))
;; update channels
...
...
This diff is collapsed.
Click to expand it.
src/metabase/pulse.clj
+
5
−
3
View file @
811086b5
...
...
@@ -19,7 +19,7 @@
"Execute the query for a single card with CARD-ID. OPTIONS are passed along to `dataset-query`."
[
card-id
&
{
:as
options
}]
{
:pre
[(
integer?
card-id
)]}
(
when-let
[
card
(
Card
card-id
)]
(
when-let
[
card
(
Card
:id
card-id
,
:archived
false
)]
(
let
[{
:keys
[
creator_id
dataset_query
]}
card
]
(
try
{
:card
card
...
...
@@ -86,8 +86,10 @@
(send-pulse! pulse :channel-ids [312]) Send only to Channel with :id = 312"
[{
:keys
[
cards
]
,
:as
pulse
}
&
{
:keys
[
channel-ids
]}]
{
:pre
[(
map?
pulse
)
(
every?
map?
cards
)
(
every?
:id
cards
)]}
(
let
[
results
(
for
[
card
cards
]
(
execute-card
(
:id
card
)
,
:pulse-id
(
:id
pulse
)))
; Pulse ID may be `nil` if the Pulse isn't saved yet
(
let
[
results
(
for
[
card
cards
:let
[
result
(
execute-card
(
:id
card
)
,
:pulse-id
(
:id
pulse
))]
; Pulse ID may be `nil` if the Pulse isn't saved yet
:when
result
]
; some cards may return empty results, e.g. if the card has been archived
result
)
channel-ids
(
or
channel-ids
(
mapv
:id
(
:channels
pulse
)))]
(
when-not
(
and
(
:skip_if_empty
pulse
)
(
are-all-cards-empty?
results
))
(
doseq
[
channel-id
channel-ids
]
...
...
This diff is collapsed.
Click to expand it.
src/metabase/query_processor/middleware/cache.clj
+
3
−
3
View file @
811086b5
...
...
@@ -58,10 +58,10 @@
([]
(
set-backend!
(
config/config-kw
:mb-qp-cache-backend
)))
([
backend
]
(
let
[
backend-ns
(
symbol
(
str
"metabase.query-processor.middleware.cache-backend."
(
munge
(
name
backend
))))]
(
require
backend-ns
)
(
let
[
backend-ns
-symb
(
symbol
(
str
"metabase.query-processor.middleware.cache-backend."
(
munge
(
name
backend
))))]
(
require
backend-ns
-symb
)
(
log/info
"Using query processor cache backend:"
(
u/format-color
'blue
backend
)
(
u/emoji
"💾"
))
(
reset!
backend-instance
(
get-backend-instance-in-namespace
backend-ns
)))))
(
reset!
backend-instance
(
get-backend-instance-in-namespace
backend-ns
-symb
)))))
...
...
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