superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grace...@apache.org
Subject [incubator-superset] branch master updated: [Fix] merge since, until request parameter with time_range (#6251)
Date Thu, 01 Nov 2018 19:41:02 GMT
This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 7d8e321  [Fix] merge since,until request parameter with time_range (#6251)
7d8e321 is described below

commit 7d8e3219fcea6c46093f5a2cb466629e0c03434e
Author: Grace Guo <grace.guo@airbnb.com>
AuthorDate: Thu Nov 1 12:40:56 2018 -0700

    [Fix] merge since,until request parameter with time_range (#6251)
---
 superset/views/core.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/superset/views/core.py b/superset/views/core.py
index 9cc564e..2af8514 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1033,6 +1033,15 @@ class Superset(BaseSupersetView):
             slc = db.session.query(models.Slice).filter_by(id=slice_id).first()
             slice_form_data = slc.form_data.copy()
             # allow form_data in request override slice from_data
+            # special treat for since/until and time_range parameter:
+            # we need to breakdown time_range into since/until so request parameters
+            # has precedence over slice parameters for time fields.
+            if 'time_range' in form_data:
+                form_data['since'], separator, form_data['until'] = \
+                    form_data['time_range'].partition(' : ')
+            if 'time_range' in slice_form_data:
+                slice_form_data['since'], separator, slice_form_data['until'] = \
+                    slice_form_data['time_range'].partition(' : ')
             slice_form_data.update(form_data)
             form_data = slice_form_data
 


Mime
View raw message