dataviz: do not update subfilters for bijoe cells (#61945)

This commit is contained in:
Valentin Deniaud 2022-02-21 09:44:00 +01:00
parent ba79988743
commit e876fd6348
2 changed files with 15 additions and 1 deletions

View File

@ -102,4 +102,6 @@ def refresh_statistics_data(cell_pk):
except ChartNgCell.DoesNotExist:
return
cell.get_statistic_data(invalidate_cache=True)
cell.update_subfilters()
if cell.statistic.service_slug != 'bijoe':
cell.update_subfilters()

View File

@ -144,6 +144,7 @@ VISUALIZATION_JSON = [
]
@remember_called
def bijoe_mock(url, request):
if url.path == '/visualization/json/':
return {'content': json.dumps(VISUALIZATION_JSON), 'request': request, 'status_code': 200}
@ -2070,3 +2071,14 @@ def test_spooler_refresh_statistics_data(new_api_statistics):
ChartNgCell.objects.all().delete()
refresh_statistics_data(cell.pk)
assert len(new_api_mock.call['requests']) == 2
@with_httmock(bijoe_mock)
def test_spooler_refresh_statistics_data_bijoe(statistics):
page = Page.objects.create(title='One', slug='index')
cell = ChartNgCell(page=page, order=1, placeholder='content')
cell.statistic = Statistic.objects.get(slug='example')
cell.save()
refresh_statistics_data(cell.pk)
assert len(bijoe_mock.call['requests']) == 1