diff --git a/.gitignore b/.gitignore index 0740715ca..b30c9723f 100644 --- a/.gitignore +++ b/.gitignore @@ -82,6 +82,9 @@ target/ .vagrant *.sublime-project *.sublime-workspace +.ipynb_checkpoints/ +*.ipynb + # specific to this project collected_static diff --git a/sapl/base/views.py b/sapl/base/views.py index c0c228c39..db1f7cc64 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -80,15 +80,20 @@ class RelatorioPresencaSessaoView(FilterView): param2 = {'sessaoplenariapresenca__%s' % sufixo: _range} pls = Parlamentar.objects.filter( - Q(**param1) & Q(**param2)).annotate( - sessao_count=Count( - 'sessaoplenariapresenca__sessao_plenaria__data_inicio', - distinct=True), - ordemdia_count=Count( - 'presencaordemdia__sessao_plenaria', - distinct=True), - sessao_porc=Count(0), - ordemdia_porc=Count(0)) + (Q(**param1) | Q(presencaordemdia__isnull=True)) & + (Q(**param2) | Q(sessaoplenariapresenca__isnull=True)) + ).annotate( + sessao_count=Count( + 'sessaoplenariapresenca__sessao_plenaria', + distinct=True), + ordemdia_count=Count( + 'presencaordemdia__sessao_plenaria', + distinct=True), + sessao_porc=Count(0), + ordemdia_porc=Count(0) + ).exclude( + sessao_count=0, + ordemdia_count=0) total_ordemdia = OrdemDia.objects.order_by( 'sessao_plenaria').filter(**param0).distinct(