Browse Source
Apply suggestions from code review
Todas as sugestões de alteração acatadas.
Co-authored-by: Edward <9326037+edwardoliveira@users.noreply.github.com>
pull/3785/head
cristian-longhi
2 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
8 additions and
19 deletions
-
sapl/relatorios/forms.py
-
sapl/relatorios/views.py
-
sapl/templates/materia/materialegislativa_filter.html
|
|
@ -91,14 +91,12 @@ class RelatorioVotacoesNominaisFilterSet(django_filters.FilterSet): |
|
|
|
) |
|
|
|
|
|
|
|
def ordem_or_expediente(self, queryset, name, value): |
|
|
|
if value: |
|
|
|
try: |
|
|
|
val = value.id |
|
|
|
except AttributeError: |
|
|
|
val = value |
|
|
|
return queryset.filter( |
|
|
|
eval(f'Q(ordem__materia__{name}={val}) | Q(expediente__materia__{name}={val})') |
|
|
|
) |
|
|
|
if value is None: |
|
|
|
return queryset |
|
|
|
value = getattr(value, "pk", value) |
|
|
|
ordem_q = f"ordem__materia__{name}" |
|
|
|
expediente_q = f"expediente__materia__{name}" |
|
|
|
return queryset.filter(Q(**{ordem_q: val})|Q(**{expediente_q: val})) |
|
|
|
return queryset |
|
|
|
|
|
|
|
class Meta(FilterOverridesMetaMixin): |
|
|
|
|
|
@ -1891,16 +1891,10 @@ class RelatorioVotacoesNominaisView(RelatorioMixin, VotacoesMultiFormatOutputMix |
|
|
|
relatorio = relatorio_votacao_nominal |
|
|
|
paginate_by = 20 |
|
|
|
|
|
|
|
fields_base_report = [ |
|
|
|
export_fields = [ |
|
|
|
'votacao_id', 'votacao', 'parlamentar__nome_parlamentar', 'voto' |
|
|
|
] |
|
|
|
|
|
|
|
fields_report = { |
|
|
|
'csv': fields_base_report, |
|
|
|
'xlsx': fields_base_report, |
|
|
|
'json': fields_base_report, |
|
|
|
} |
|
|
|
|
|
|
|
def get_queryset(self): |
|
|
|
if 'format' in self.request.GET: |
|
|
|
self.model = VotoParlamentar |
|
|
|
|
|
@ -244,13 +244,10 @@ |
|
|
|
|
|
|
|
<script type="text/javascript" > |
|
|
|
$( document ).ready(function() { |
|
|
|
const links_votacao = document.querySelectorAll('.link_votacao_nominal'); |
|
|
|
links_votacao.forEach(link => { |
|
|
|
link.addEventListener('click', function(event) { |
|
|
|
$('.link_votacao_nominal').on('click', function(event) { |
|
|
|
event.preventDefault(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
function pesquisaAvancada(){ |
|
|
|
$('.pesquisa_avancada').toggle(); |
|
|
|