Skip to content

Commit

Permalink
[bugfix] preserve order in groupby (#3268)
Browse files Browse the repository at this point in the history
Recently in
4c3313b
I introduced an issue where the order of groupby fields might change.

This addresses this issue and will preserve ordering.
  • Loading branch information
mistercrunch authored Aug 10, 2017
1 parent 0cf0860 commit 57421d1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,13 @@ def get_extra_filters(self):
def query_obj(self):
"""Building a query object"""
form_data = self.form_data
groupby = form_data.get("groupby") or []
gb = form_data.get("groupby") or []
metrics = form_data.get("metrics") or []
columns = form_data.get("columns") or []
groupby = list(set(groupby + columns))
groupby = []
for o in gb + columns:
if o not in groupby:
groupby.append(o)

is_timeseries = self.is_timeseries
if DTTM_ALIAS in groupby:
Expand Down

0 comments on commit 57421d1

Please sign in to comment.