-
- Downloads
Incorrect progressbar alert 10899 (#19649)
* Comparison for goals depends on alert_above_goal and if progressbar. This commit sets up the timeseries predicate and writes tests for what I think the correct behaviours should be: timeseries, alert above -> (<= goal-value value) - (<= 5.9 6) true -> alert sent - (<= 6 6) true -> alert sent - (<= 6.1 6) false -> alert not sent progressbar, alert above -> (<= goal-value value) - (<= 5.9 6) true -> alert sent - (<= 6 6) true -> alert sent - (<= 6.1 6) false -> alert not sent timeseries, alert below -> (>= goal-value value) - (>= 6.1 6) true -> alert sent - (>= 6 6) true -> alert sent. NOTE: this is to match prior behaviour, but I don't understand why it is this way? - (>= 5.9 6) faluse -> alert not sent progressbar, alert below -> (> goal-value value) - (> 6.1 6) true -> alert sent - (> 6 6) false -> alert not sent. NOTE: this is what should fix the bug (#10899) - (> 5.9 6) faluse -> alert not sent I think there may be a cleaner way to write and present the tests, so the next commit(s) will address that. * Simplified Tests for goal-met? predicate. The goal-met predicate is tested directly with mock data to make the tests more readable. The change to `metabase.pulse/goal-met?` fixes #10899 while preserving the goal-met behaviour for any non-progress goal. The behaviour should now be as follows: ``` | Timeseries? | alert_above? | goal | val | goal-met? | +-------------+--------------+------+-----+-----------+ | f | t | 5 | 4 | f | | f | t | 5 | 5 | t | | f | t | 5 | 6 | t | | f | f | 5 | 4 | t | | f | f | 5 | 5 | f | <--- this is new behaviour | f | f | 5 | 6 | f | | t | t | 5 | 4 | f | | t | t | 5 | 5 | t | | t | t | 5 | 6 | t | | t | f | 5 | 4 | t | | t | f | 5 | 5 | t | | t | f | 5 | 6 | f | ``` Otherwise, alerts should be triggered as before. * added issue number to test * fixed alignment issue * swapped goal and value around in comparison for readability * Fixing nits * Timeseries and progress bar now follow same logic I asked for clarification about when alerts fire in #ama-product in Metabase's Slack. There was consensus around the idea that 'reaches the goal' does generally imply 'meets the goal', so we can use the same comparators between progress bar and timeseries goals now. This simplifies the goal-met? function again because it's no longer necessary to check if the given data is a timeseries goal. * Adjusted text in goal line alert modal * ran prettier
Showing
- frontend/src/metabase/query_builder/components/AlertModals.jsx 1 addition, 3 deletions...end/src/metabase/query_builder/components/AlertModals.jsx
- frontend/test/metabase/scenarios/sharing/alert/alert-types.cy.spec.js 1 addition, 1 deletion...t/metabase/scenarios/sharing/alert/alert-types.cy.spec.js
- src/metabase/pulse.clj 5 additions, 4 deletionssrc/metabase/pulse.clj
- test/metabase/pulse_test.clj 35 additions, 0 deletionstest/metabase/pulse_test.clj
Please register or sign in to comment