From 0c464b685930aa28476c134d003e138c0c9434a3 Mon Sep 17 00:00:00 2001 From: Victor Fabre Date: Thu, 20 Dec 2018 14:04:13 -0200 Subject: [PATCH] Fix #2435 (#2436) --- sapl/base/views.py | 7 ++++++- sapl/templates/base/RelatorioPresencaSessao_filter.html | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sapl/base/views.py b/sapl/base/views.py index 599d6b05f..8d5acce7b 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -10,7 +10,7 @@ from django.contrib.auth.tokens import default_token_generator from django.core.exceptions import ObjectDoesNotExist, PermissionDenied from django.core.mail import send_mail from django.core.urlresolvers import reverse -from django.db.models import Count +from django.db.models import Count, Q from django.http import Http404, HttpResponseRedirect from django.template import TemplateDoesNotExist from django.template.loader import get_template @@ -373,8 +373,13 @@ class RelatorioPresencaSessaoView(FilterView): # Completa o dicionario as informacoes parlamentar/sessao/ordem parlamentares_presencas = [] for i, p in enumerate(parlamentares_qs): + m = p.mandato_set.filter(Q(data_inicio_mandato__lte=_range[0], data_fim_mandato__gte=_range[1]) | + Q(data_inicio_mandato__lte=_range[0], data_fim_mandato__isnull=True) | + Q(data_inicio_mandato__gte=_range[0], data_fim_mandato__lte=_range[1])) + m = m.last() parlamentares_presencas.append({ 'parlamentar': p, + 'titular': m.titular, 'sessao_porc': 0, 'ordemdia_porc': 0 }) diff --git a/sapl/templates/base/RelatorioPresencaSessao_filter.html b/sapl/templates/base/RelatorioPresencaSessao_filter.html index e3e447f8d..9836235ca 100644 --- a/sapl/templates/base/RelatorioPresencaSessao_filter.html +++ b/sapl/templates/base/RelatorioPresencaSessao_filter.html @@ -25,6 +25,7 @@ Nome Parlamentar / Partido + Titular Sessão Ordem do Dia @@ -39,6 +40,7 @@ {% for p in parlamentares %} {{p.parlamentar}} / {{p.parlamentar|filiacao_intervalo_filter:date_range|default:"Sem Partido"}} + {%if p.titular %} Sim {% else %} Não {% endif %} {{p.sessao_count}} {{p.sessao_porc}} {{p.ordemdia_count}}