From 10b127edd3ad3a3f59453cd9ac1c2d7ede2b7737 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Mon, 4 Jul 2022 16:10:49 +0200 Subject: [PATCH] dataviz: do not refresh subfilters for bijoe stat (#66936) --- combo/apps/dataviz/views.py | 2 +- tests/test_dataviz.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/combo/apps/dataviz/views.py b/combo/apps/dataviz/views.py index 5e1c3a88..964e8a37 100644 --- a/combo/apps/dataviz/views.py +++ b/combo/apps/dataviz/views.py @@ -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': diff --git a/tests/test_dataviz.py b/tests/test_dataviz.py index 292402c5..ce769b20 100644 --- a/tests/test_dataviz.py +++ b/tests/test_dataviz.py @@ -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