engine: allow dimensions without joins (fixes #28191)

This commit is contained in:
Benjamin Dauvergne 2018-11-20 15:29:42 +01:00
parent cde575ce88
commit e9a4301542
3 changed files with 23 additions and 1 deletions

View File

@ -289,7 +289,7 @@ class EngineCube(object):
for dimension_name in drilldown:
dimension = self.dimensions[dimension_name]
joins.update(dimension.join)
joins.update(dimension.join or [])
projections.append('%s AS %s' % (dimension.value_label or dimension.value,
dimension.name))
group_by.append(dimension.group_by or dimension.value)

View File

@ -68,6 +68,18 @@
}
],
"dimensions": [
{
"name": "date",
"label": "Date",
"type": "date",
"value": "date"
},
{
"name": "hour",
"type": "integer",
"label": "Hour",
"value": "EXTRACT(hour from datetime)"
},
{
"name": "innersubcategory",
"label": "Inner SubCategory",

View File

@ -27,3 +27,13 @@ def test_simple(schema1, app, admin):
[u'Inner SubCategory', u'subé1', u'subé3'],
['number of rows', '15', '1'],
]
form = response.form
form.set('representation', 'table')
form.set('measure', 'simple_count')
form.set('drilldown_x', 'date__month')
response = form.submit('visualize')
assert 'big-msg-info' not in response
assert get_table(response) == [
['mois (Date)', 'janvier', u'f\xe9vrier', 'mars', 'avril', 'mai', 'juin', 'juillet', u'ao\xfbt'],
['number of rows', '10', '1', '1', '1', '1', '1', '1', '1'],
]