Projet

Général

Profil

0001-dataviz-do-not-refresh-subfilters-for-bijoe-stat-669.patch

Valentin Deniaud, 04 juillet 2022 16:13

Télécharger (1,82 ko)

Voir les différences:

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(-)
combo/apps/dataviz/views.py
89 89
            else:
90 90
                return self.error(_('Unknown HTTP error: %s' % e))
91 91

  
92
        if self.filters_cell_id:
92
        if self.filters_cell_id and self.cell.statistic.service_slug != 'bijoe':
93 93
            self.update_subfilters_cache(form.instance)
94 94

  
95 95
        if self.cell.chart_type == 'table':
tests/test_dataviz.py
2687 2687
    resp = app.get(location + '?filter-form=food-request&filters_cell_id=xxx')
2688 2688
    assert 'filter-form' in resp.form.fields
2689 2689
    assert 'filter-menu' in resp.form.fields
2690

  
2691

  
2692
@with_httmock(bijoe_mock)
2693
def test_chart_filters_cell_dynamic_subfilters_bijoe(app, statistics):
2694
    page = Page.objects.create(title='One', slug='index')
2695
    ChartFiltersCell.objects.create(page=page, order=1, placeholder='content')
2696
    cell = ChartNgCell.objects.create(page=page, order=2, placeholder='content')
2697
    cell.statistic = Statistic.objects.get(slug='example')
2698
    cell.save()
2699

  
2700
    resp = app.get('/api/dataviz/graph/%s/' % cell.pk + '?filters_cell_id=xxx')
2701
    assert 'pygal-chart' in resp.text
2690
-