Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't send results works at the card level #37546

Merged
merged 2 commits into from
Jan 11, 2024

Conversation

markbastian
Copy link
Contributor

When a user enables Don't send if there aren't results this was the previous behavior:

  • If no results appeared on any card, no emails was sent. This was expected.
  • If any card contained results, all cards were sent in the email, including those that had no results.

This PR modifieds that behavior to only send those cards that contain results for a dashboard pulse. For example, if 5 cards are present on a dashboard and 3 have no results, only results for the 2 cards containing data are included in the pulse.

Primary changes:

  • metabase.pulse/execute-dashboard now removes any card with a row count of 0 in its computed result if skip_if_empty is true for the pulse.
  • The addition of tests covering the matrix of tests where skip_if_empty is true or false, all cards contain data, some cards contain data, and no cards contain data.
  • The with-skip-if-empty-pulse-result makes the above set of tests nice and concise.

Minor changes:

  • Fixing a minor issue in with-metadata-data-cards in which the macroexpansion logic would go bad if the user used a different symbol name for base-card-id.
  • Spelling and formatting issues in metabase.pulse

Fixes #34777

When a user enables **Don't send if there aren't results** this was the previous behavior:
- If no results appeared on any card, no emails was sent. This was expected.
- If any card contained results, all cards were sent in the email, including those that had no results.

This PR modifieds that behavior to only send those cards that contain results for a dashboard pulse. For example, if 5 cards are present on a dashboard and 3 have no results, only results for the 2 cards containing data are included in the pulse.

Primary changes:
- `metabase.pulse/execute-dashboard` now removes any card with a row count of 0 in its computed result if `skip_if_empty` is true for the pulse.
- The addition of tests covering the matrix of tests where `skip_if_empty` is true or false, all cards contain data, some cards contain data, and no cards contain data.
- The `with-skip-if-empty-pulse-result` makes the above set of tests nice and concise.

Minor changes:
- Fixing a minor issue in `with-metadata-data-cards` in which the macroexpansion logic would go bad if the user used a different symbol name for `base-card-id`.
- Spelling and formatting issues in `metabase.pulse`

Fixes #34777
@markbastian markbastian self-assigned this Jan 10, 2024
@metabase-bot metabase-bot bot added the .Team/DashViz Dashboard and Viz team label Jan 10, 2024
@markbastian markbastian added the backport Automatically create PR on current release branch on merge label Jan 10, 2024
Copy link
Contributor

@adam-james-v adam-james-v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@markbastian markbastian enabled auto-merge (squash) January 11, 2024 01:34
@markbastian markbastian merged commit 6f0161a into master Jan 11, 2024
103 of 104 checks passed
@markbastian markbastian deleted the do-not-email-empty-cards-34777 branch January 11, 2024 01:50
Copy link

@markbastian Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone?

markbastian added a commit that referenced this pull request Jan 11, 2024
* Don't send results works at the card level

When a user enables **Don't send if there aren't results** this was the previous behavior:
- If no results appeared on any card, no emails was sent. This was expected.
- If any card contained results, all cards were sent in the email, including those that had no results.

This PR modifieds that behavior to only send those cards that contain results for a dashboard pulse. For example, if 5 cards are present on a dashboard and 3 have no results, only results for the 2 cards containing data are included in the pulse.

Primary changes:
- `metabase.pulse/execute-dashboard` now removes any card with a row count of 0 in its computed result if `skip_if_empty` is true for the pulse.
- The addition of tests covering the matrix of tests where `skip_if_empty` is true or false, all cards contain data, some cards contain data, and no cards contain data.
- The `with-skip-if-empty-pulse-result` makes the above set of tests nice and concise.

Minor changes:
- Fixing a minor issue in `with-metadata-data-cards` in which the macroexpansion logic would go bad if the user used a different symbol name for `base-card-id`.
- Spelling and formatting issues in `metabase.pulse`

Fixes #34777

* lint fix for #_{:clj-kondo/ignore [:unresolved-symbol]}

(cherry picked from commit 6f0161a)
markbastian added a commit that referenced this pull request Jan 11, 2024
* Don't send results works at the card level

When a user enables **Don't send if there aren't results** this was the previous behavior:
- If no results appeared on any card, no emails was sent. This was expected.
- If any card contained results, all cards were sent in the email, including those that had no results.

This PR modifieds that behavior to only send those cards that contain results for a dashboard pulse. For example, if 5 cards are present on a dashboard and 3 have no results, only results for the 2 cards containing data are included in the pulse.

Primary changes:
- `metabase.pulse/execute-dashboard` now removes any card with a row count of 0 in its computed result if `skip_if_empty` is true for the pulse.
- The addition of tests covering the matrix of tests where `skip_if_empty` is true or false, all cards contain data, some cards contain data, and no cards contain data.
- The `with-skip-if-empty-pulse-result` makes the above set of tests nice and concise.

Minor changes:
- Fixing a minor issue in `with-metadata-data-cards` in which the macroexpansion logic would go bad if the user used a different symbol name for `base-card-id`.
- Spelling and formatting issues in `metabase.pulse`

Fixes #34777

* lint fix for #_{:clj-kondo/ignore [:unresolved-symbol]}

(cherry picked from commit 6f0161a)
markbastian added a commit that referenced this pull request Jan 11, 2024
As a follow on to #37546, this fixes an issue in which the macroexpansion of `with-skip-if-empty-pulse-result` doesn't capture the scope of the arguments in `skip-if-empty-test`.

The solution is just to _correctly_ wrap all of the `mt/id` functions in `mt/dataset`.
markbastian added a commit that referenced this pull request Jan 11, 2024
* Don't send results works at the card level (#37546)

* Don't send results works at the card level

When a user enables **Don't send if there aren't results** this was the previous behavior:
- If no results appeared on any card, no emails was sent. This was expected.
- If any card contained results, all cards were sent in the email, including those that had no results.

This PR modifieds that behavior to only send those cards that contain results for a dashboard pulse. For example, if 5 cards are present on a dashboard and 3 have no results, only results for the 2 cards containing data are included in the pulse.

Primary changes:
- `metabase.pulse/execute-dashboard` now removes any card with a row count of 0 in its computed result if `skip_if_empty` is true for the pulse.
- The addition of tests covering the matrix of tests where `skip_if_empty` is true or false, all cards contain data, some cards contain data, and no cards contain data.
- The `with-skip-if-empty-pulse-result` makes the above set of tests nice and concise.

Minor changes:
- Fixing a minor issue in `with-metadata-data-cards` in which the macroexpansion logic would go bad if the user used a different symbol name for `base-card-id`.
- Spelling and formatting issues in `metabase.pulse`

Fixes #34777

* lint fix for #_{:clj-kondo/ignore [:unresolved-symbol]}

(cherry picked from commit 6f0161a)

* Fixing test dataset reference
markbastian added a commit that referenced this pull request Jan 11, 2024
As a follow on to #37546, this fixes an issue in which the macroexpansion of `with-skip-if-empty-pulse-result` doesn't capture the scope of the arguments in `skip-if-empty-test`.

The solution is just to _correctly_ wrap all of the `mt/id` functions in `mt/dataset`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Automatically create PR on current release branch on merge .Team/DashViz Dashboard and Viz team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting all reports to hide with no results breaks dashboard subscription
2 participants