This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch sc-69810
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 131f752588ed63ba2e0f0531bb9a9a8209fe0902
Author: Beto Dealmeida <[email protected]>
AuthorDate: Wed Nov 29 17:23:29 2023 -0500

    fix(annotations): time grain column
---
 superset-frontend/src/components/Chart/chartAction.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/superset-frontend/src/components/Chart/chartAction.js 
b/superset-frontend/src/components/Chart/chartAction.js
index 9e5dc0eddd..bdf4fe8ac7 100644
--- a/superset-frontend/src/components/Chart/chartAction.js
+++ b/superset-frontend/src/components/Chart/chartAction.js
@@ -269,9 +269,13 @@ export function runAnnotationQuery({
       return Promise.resolve();
     }
 
-    const granularity = fd.time_grain_sqla || fd.granularity;
-    fd.time_grain_sqla = granularity;
-    fd.granularity = granularity;
+    // remap from controls to formData naming; in the original formData the
+    // `granularity` attribute represents the time grain, but in the request
+    // payload it corresponds to the name of the column where the time grain
+    // should be applied...
+    fd.time_grain_sqla = fd.time_grain_sqla || fd.granularity;
+    fd.granularity = fd.granularity_sqla;
+
     const overridesKeys = Object.keys(annotation.overrides);
     if (overridesKeys.includes('since') || overridesKeys.includes('until')) {
       annotation.overrides = {

Reply via email to