From c05659ae096b4b38cbe271518ce9a84fa0584371 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Wed, 1 Nov 2017 16:10:57 -0200 Subject: [PATCH] =?UTF-8?q?Retorna=20o=20=C3=BAltimo=20turno=20de=20uma=20?= =?UTF-8?q?tramita=C3=A7=C3=A3o=20onde=20turno=20n=C3=A3o=20=C3=A9=20vazio?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/relatorios/views.py | 10 ++++++++-- sapl/sessao/views.py | 9 ++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py index b5e0b4de2..c6e429afe 100644 --- a/sapl/relatorios/views.py +++ b/sapl/relatorios/views.py @@ -740,8 +740,14 @@ def get_sessao_plenaria(sessao, casa): def get_turno(dic, materia): descricao_turno = ' ' descricao_tramitacao = ' ' - tramitacao = Tramitacao.objects.filter(materia=materia).order_by( - '-data_tramitacao').first() + tramitacao = Tramitacao.objects.filter(materia=materia, turno__isnull=False + ).exclude(turno__exact='' + ).select_related( + 'materia', + 'status', + 'materia__tipo').order_by( + '-data_tramitacao' + ).first() if tramitacao is not None: for t in Tramitacao.TURNO_CHOICES: if t[0] == tramitacao.turno: diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index 536e13b67..acbe413a2 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -168,7 +168,14 @@ def customize_link_materia(context): autor = autoria.autor if autoria else None num_protocolo = materia.numero_protocolo - tramitacao = Tramitacao.objects.filter(materia=materia).last() + tramitacao = Tramitacao.objects.filter(materia=materia, turno__isnull=False + ).exclude(turno__exact='' + ).select_related( + 'materia', + 'status', + 'materia__tipo').order_by( + '-data_tramitacao' + ).first() turno = ' ' if tramitacao is not None: for t in Tramitacao.TURNO_CHOICES: