dataviz: do not refresh subfilters for bijoe stat (#66936)

This commit is contained in:
Valentin Deniaud 2022-07-04 16:10:49 +02:00
parent 6807e032a7
commit 10b127edd3
2 changed files with 13 additions and 1 deletions

View File

@ -89,7 +89,7 @@ class DatavizGraphView(DetailView):
else:
return self.error(_('Unknown HTTP error: %s' % e))
if self.filters_cell_id:
if self.filters_cell_id and self.cell.statistic.service_slug != 'bijoe':
self.update_subfilters_cache(form.instance)
if self.cell.chart_type == 'table':

View File

@ -2687,3 +2687,15 @@ def test_chart_filters_cell_dynamic_subfilters(new_api_statistics, app, admin_us
resp = app.get(location + '?filter-form=food-request&filters_cell_id=xxx')
assert 'filter-form' in resp.form.fields
assert 'filter-menu' in resp.form.fields
@with_httmock(bijoe_mock)
def test_chart_filters_cell_dynamic_subfilters_bijoe(app, statistics):
page = Page.objects.create(title='One', slug='index')
ChartFiltersCell.objects.create(page=page, order=1, placeholder='content')
cell = ChartNgCell.objects.create(page=page, order=2, placeholder='content')
cell.statistic = Statistic.objects.get(slug='example')
cell.save()
resp = app.get('/api/dataviz/graph/%s/' % cell.pk + '?filters_cell_id=xxx')
assert 'pygal-chart' in resp.text