Skip to content

Commit

Permalink
[hotfix] issues around empty params
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Sep 23, 2016
1 parent 7f3c205 commit 9890259
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions caravel/models.py
Expand Up @@ -271,6 +271,10 @@ def get_viz(self, url_params_multidict=None):
slice_params['viz_type'] = self.viz_type if self.viz_type else "table"
if url_params_multidict:
slice_params.update(url_params_multidict)
to_del = [k for k in slice_params if k not in url_params_multidict]
for k in to_del:
del slice_params[k]

immutable_slice_params = ImmutableMultiDict(slice_params)
return viz_types[immutable_slice_params.get('viz_type')](
self.datasource,
Expand Down
6 changes: 3 additions & 3 deletions caravel/viz.py
Expand Up @@ -1657,16 +1657,16 @@ class FilterBoxViz(BaseViz):

def query_obj(self):
qry = super(FilterBoxViz, self).query_obj()
groupby = self.form_data['groupby']
if len(groupby) < 1:
groupby = self.form_data.get('groupby')
if len(groupby) < 1 and not self.form_data.get('date_filter'):
raise Exception("Pick at least one filter field")
qry['metrics'] = [
self.form_data['metric']]
return qry

def get_data(self):
qry = self.query_obj()
filters = [g for g in qry['groupby']]
filters = [g for g in self.form_data['groupby']]
d = {}
for flt in filters:
qry['groupby'] = [flt]
Expand Down

0 comments on commit 9890259

Please sign in to comment.