diff --git a/sapl/base/views.py b/sapl/base/views.py index 3723a18be..133c1b0d5 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -633,12 +633,13 @@ class RelatorioMateriasTramitacaoView(FilterView): qs = filtra_url_materias_em_tramitacao( qr, qs, 'tramitacao__status', 'status') - context['object_list'] = qs + li = [li1 for li1 in qs if li1.tramitacao_set.last() and li1.tramitacao_set.last().status.indicador != 'F'] + context['object_list'] = li qtdes = {} for tipo in TipoMateriaLegislativa.objects.all(): - qs = context['object_list'] - qtde = len(qs.filter(tipo_id=tipo.id)) + li = context['object_list'] + qtde = sum(1 for i in li if i.tipo_id==tipo.id) if qtde > 0: qtdes[tipo] = qtde context['qtdes'] = qtdes