Fix for undefined inner_time_filter on missing granularity in models.SqlaTable (#309)

This commit is contained in:
antbell 2016-04-11 01:22:58 +02:00 committed by Maxime Beauchemin
parent fe045ad076
commit a9af6b1b96
2 changed files with 7 additions and 0 deletions

View File

@ -587,6 +587,8 @@ class SqlaTable(Model, Queryable, AuditMixinNullable):
inner_time_filter[0] = timestamp >= inner_from_dttm.strftime(tf)
if inner_to_dttm:
inner_time_filter[1] = timestamp <= inner_to_dttm.strftime(tf)
else:
inner_time_filter = []
select_exprs += metrics_exprs
qry = select(select_exprs)

View File

@ -63,6 +63,11 @@ class CaravelTests(unittest.TestCase):
def test_csv(self):
self.client.get('/caravel/explore/table/1/?viz_type=table&granularity=ds&since=100+years&until=now&metrics=count&groupby=name&limit=50&show_brush=y&show_brush=false&show_legend=y&show_brush=false&rich_tooltip=y&show_brush=false&show_brush=false&show_brush=false&show_brush=false&y_axis_format=&x_axis_showminmax=y&show_brush=false&line_interpolation=linear&rolling_type=None&rolling_periods=&time_compare=&num_period_compare=&where=&having=&flt_col_0=gender&flt_op_0=in&flt_eq_0=&flt_col_0=gender&flt_op_0=in&flt_eq_0=&slice_id=14&slice_name=Boys&collapsed_fieldsets=&action=&datasource_name=birth_names&datasource_id=1&datasource_type=table&previous_viz_type=line&csv=true')
def test_bubble_chart_no_time(self):
self.login()
response = self.client.get('/caravel/explore/table/1/?viz_type=bubble&series=source&entity=source&x=count&y=count&size=count&limit=50&x_log_scale=false&y_log_scale=false&show_legend=y&show_legend=false&max_bubble_size=25&where=&having=&flt_col_0=source&flt_op_0=in&flt_eq_0=&slice_id=&slice_name=&collapsed_fieldsets=&action=&datasource_name=energy_usage&datasource_id=1&datasource_type=table&previous_viz_type=bubble&json=true&force=false')
self.assertEqual(response.status_code, 200)
def test_dashboard(self):
self.login()
urls = {}