From 79e35b77afc54e820f97eb4216f2f095975d40e1 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Mon, 17 Jan 2022 15:05:35 +0100 Subject: [PATCH] api: require category when getting form statistics (#60732) --- wcs/statistics/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wcs/statistics/views.py b/wcs/statistics/views.py index a0fa5e22..ed0e2e8b 100644 --- a/wcs/statistics/views.py +++ b/wcs/statistics/views.py @@ -78,7 +78,7 @@ class IndexView(RestrictedView): 'id': 'category', 'label': _('Category'), 'options': category_options, - 'required': False, + 'required': True, 'default': '_all', }, ], @@ -98,8 +98,8 @@ class FormsCountView(RestrictedView): 'period_end': request.GET.get('end'), 'criterias': [], } - category_id = request.GET.get('category') - if category_id and category_id != '_all': + category_id = request.GET.get('category', '_all') + if category_id != '_all': totals_kwargs['criterias'].append(Equal('category_id', category_id)) time_interval_methods = { 'month': sql.get_monthly_totals, -- 2.30.2