From b7acbd8d100fc8690863a8a396096fa3df3a895a Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Thu, 27 Aug 2015 09:16:29 -0700 Subject: [PATCH] Bugfix on timeseries where granularity=all --- TODO.md | 7 +++---- app/viz.py | 16 ++++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/TODO.md b/TODO.md index b85494863..872b294f7 100644 --- a/TODO.md +++ b/TODO.md @@ -1,8 +1,7 @@ # TODO * in/notin filters autocomplete -* Scatter plot -* Allow for post aggregations (ratios!) +* DRUID: Allow for post aggregations (ratios!) * compare time ranges -* Add verbose_name and label method to metrics and columns -* csv +* csv export out of table view * Save / bookmark / url shortener +* SQL: Find a way to manage granularity diff --git a/app/viz.py b/app/viz.py index 60b4e5ac6..6f71a3a66 100644 --- a/app/viz.py +++ b/app/viz.py @@ -85,8 +85,6 @@ class BaseViz(object): if self.df is not None: if 'timestamp' in self.df.columns: self.df.timestamp = pd.to_datetime(self.df.timestamp) - self.df_prep() - self.form_prep() except Exception as e: logging.exception(e) self.error_msg = str(e) @@ -111,6 +109,9 @@ class BaseViz(object): return self.datasource.query(**self.query_obj()) def query_obj(self): + """ + Building a query object + """ ds = self.datasource args = self.form_data groupby = args.getlist("groupby") or [] @@ -144,12 +145,6 @@ class BaseViz(object): } return d - def df_prep(self): - pass - - def form_prep(self): - pass - def render_no_data(self): self.template = "panoramix/no_data.html" return BaseViz.render(self) @@ -272,6 +267,11 @@ class TimeSeriesViz(HighchartsViz): sort_legend_y = True def render(self): + if request.args.get("granularity") == "all": + self.error_msg = ( + "You have to select a time granularity for this view") + return super(TimeSeriesViz, self).render(error_msg=self.error_msg) + metrics = self.metrics df = self.df df = df.pivot_table(