From dee41c16120b9171b9e5b6ea5fb9386eb0b362e8 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Fri, 2 Sep 2016 15:35:48 -0300 Subject: [PATCH] Fix #556 --- sapl/sessao/views.py | 16 +++++++++++++++- sapl/templates/sessao/presenca.html | 2 +- sapl/templates/sessao/presenca_ordemdia.html | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index 831c28b96..805609b9b 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -420,7 +420,7 @@ class SessaoCrud(Crud): class PresencaMixin: - def get_parlamentares(self): + def get_presencas(self): self.object = self.get_object() presencas = SessaoPlenariaPresenca.objects.filter( @@ -434,6 +434,20 @@ class PresencaMixin: else: yield (parlamentar, False) + def get_presencas_ordem(self): + self.object = self.get_object() + + presencas = PresencaOrdemDia.objects.filter( + sessao_plenaria_id=self.object.id + ) + presentes = [p.parlamentar for p in presencas] + + for parlamentar in Parlamentar.objects.filter(ativo=True): + if parlamentar in presentes: + yield (parlamentar, True) + else: + yield (parlamentar, False) + class PresencaView(PermissionRequiredMixin, FormMixin, diff --git a/sapl/templates/sessao/presenca.html b/sapl/templates/sessao/presenca.html index 3cf93b505..3efb72734 100644 --- a/sapl/templates/sessao/presenca.html +++ b/sapl/templates/sessao/presenca.html @@ -14,7 +14,7 @@
Marcar/Desmarcar Todos
- {% for parlamentar, check in view.get_parlamentares %} + {% for parlamentar, check in view.get_presencas %}
diff --git a/sapl/templates/sessao/presenca_ordemdia.html b/sapl/templates/sessao/presenca_ordemdia.html index a660484c0..2becae461 100644 --- a/sapl/templates/sessao/presenca_ordemdia.html +++ b/sapl/templates/sessao/presenca_ordemdia.html @@ -14,7 +14,7 @@
Marcar/Desmarcar Todos
- {% for parlamentar, check in view.get_parlamentares %} + {% for parlamentar, check in view.get_presencas_ordem %}