Skip to content

Commit

Permalink
Bugfix on timeseries where granularity=all
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Aug 27, 2015
1 parent 8e5a827 commit b7acbd8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
7 changes: 3 additions & 4 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -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
16 changes: 8 additions & 8 deletions app/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ def __init__(self, datasource, form_data, view):
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)
Expand All @@ -111,6 +109,9 @@ def bake_query(self):
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 []
Expand Down Expand Up @@ -144,12 +145,6 @@ def query_obj(self):
}
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)
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit b7acbd8

Please sign in to comment.