[bugfix] preserve order in groupby (#3268)

Recently in
4c3313b01c
I introduced an issue where the order of groupby fields might change.

This addresses this issue and will preserve ordering.
This commit is contained in:
Maxime Beauchemin 2017-08-09 18:06:18 -07:00 committed by GitHub
parent 0cf0860a3d
commit 57421d14d0

View File

@ -112,10 +112,13 @@ class BaseViz(object):
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: