From 4f93726a48cf261d490ada264c60ca5307902e6c Mon Sep 17 00:00:00 2001 From: Cesar Carvalho Date: Mon, 8 Jul 2019 15:09:58 -0300 Subject: [PATCH] =?UTF-8?q?Salvar=20registro=20de=20voto=20do=20parlamenta?= =?UTF-8?q?r=20na=20vota=C3=A7=C3=A3o=20pelo=20operador?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/painel/views.py | 7 +++++++ sapl/sessao/views.py | 8 ++++---- sapl/templates/painel/index.html | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/sapl/painel/views.py b/sapl/painel/views.py index e253d270f..4c3a85baf 100644 --- a/sapl/painel/views.py +++ b/sapl/painel/views.py @@ -531,6 +531,13 @@ def get_votos(response, materia): votos_parlamentares = VotoParlamentar.objects.filter( expediente_id=materia.id).order_by( 'parlamentar__nome_parlamentar') + + if PainelConfig.attr('mostrar_votos_antecedencia'): + response['numero_votos_sim'] = votos_parlamentares.filter(voto="Sim").count() + response['numero_votos_nao'] = votos_parlamentares.filter(voto="Não").count() + response['numero_abstencoes'] = votos_parlamentares.filter(voto="Abstenção").count() + response['total_votos'] = response['numero_votos_sim'] + response['numero_votos_nao'] + \ + response['numero_abstencoes'] for i, p in enumerate(response['presentes']): try: diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index a73662ab4..f0993dfc0 100755 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -4342,10 +4342,10 @@ class RetiradaPautaCrud(MasterDetailCrud): def voto_nominal_parlamentar(request): - parlamentar_id = request.GET['parlamentar_id'] - parlamentar_voto = request.GET['parlamentar_voto'] - id_ordem_expediente = request.GET['id_ordem_expediente'] - is_ordemdia = request.GET['is_ordemdia'] == 'true' + parlamentar_id = request.GET.get('parlamentar_id') + parlamentar_voto = request.GET.get('parlamentar_voto') + id_ordem_expediente = request.GET.get('id_ordem_expediente') + is_ordemdia = request.GET.get('is_ordemdia') == 'true' if is_ordemdia: # Apaga o voto (opção selecionada: Não Votou) diff --git a/sapl/templates/painel/index.html b/sapl/templates/painel/index.html index 0587042d5..3de48acd2 100644 --- a/sapl/templates/painel/index.html +++ b/sapl/templates/painel/index.html @@ -252,7 +252,7 @@ // Parlamentar já votou? if (parlamentar.voto){ // Se a votação já foi finalizada, mostra todos os votos - if (data['tipo_resultado']){ + if (data['tipo_resultado'] && data['tipo_resultado'] != "Ainda não foi votada."){ $('#parlamentares_list').append('' + parlamentar.nome + ' ' + @@ -314,7 +314,7 @@ votacao.append(''); } - if (data['materia_legislativa_texto'] && data["status_painel"] == true){ + if (data['materia_legislativa_texto'] && data["status_painel"]){ var votacao = $("#votacao")