From 7735e4e2c7c97c0fd2590f4b3cedb42c694e07af Mon Sep 17 00:00:00 2001 From: cristian-longhi Date: Thu, 6 Nov 2025 18:06:02 -0300 Subject: [PATCH 1/8] =?UTF-8?q?Conserta=20bug=20na=20pesquisa=20do=20Relat?= =?UTF-8?q?=C3=B3rio=20de=20Vota=C3=A7=C3=B5es=20Nominais=20(#3803)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix recibo proposição e adiciona rate limiter em matéria e norma * Conserta bug na pesquisa do Relatório de Votações Nominais Na pesquisa, ao selecionar filtro por Tipo de Matéria, Número e/ou Ano da Matéria, o sistema retorna erro 500. * Fix recibo proposição e adiciona rate limiter em matéria e norma --------- Co-authored-by: Edward Oliveira --- sapl/relatorios/forms.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sapl/relatorios/forms.py b/sapl/relatorios/forms.py index c6edc7d49..23145f899 100644 --- a/sapl/relatorios/forms.py +++ b/sapl/relatorios/forms.py @@ -70,16 +70,16 @@ class RelatorioDocumentosAcessoriosFilterSet(django_filters.FilterSet): ) -def ordem_or_expediente(queryset, name, value): - 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: value}) | Q(**{expediente_q: value})) +class RelatorioVotacoesNominaisFilterSet(django_filters.FilterSet): + def ordem_or_expediente(self, queryset, name, value): + 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: value}) | Q(**{expediente_q: value})) -class RelatorioVotacoesNominaisFilterSet(django_filters.FilterSet): tipo_id = django_filters.ModelChoiceFilter( queryset=TipoMateriaLegislativa.objects.all(), method='ordem_or_expediente', From 2f1189e6b264dd55927da78e8850385f4a679959 Mon Sep 17 00:00:00 2001 From: Edward Oliveira Date: Mon, 1 Dec 2025 15:06:18 -0300 Subject: [PATCH 2/8] =?UTF-8?q?Aumento=20do=20tamanho=20de=20Nome=20e=20Te?= =?UTF-8?q?ma=20da=20Audi=C3=AAncia=20P=C3=BAblica?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0020_auto_20251201_1450.py | 28 +++++++++++++++++++ sapl/audiencia/models.py | 4 +-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 sapl/audiencia/migrations/0020_auto_20251201_1450.py diff --git a/sapl/audiencia/migrations/0020_auto_20251201_1450.py b/sapl/audiencia/migrations/0020_auto_20251201_1450.py new file mode 100644 index 000000000..6afbd9b0e --- /dev/null +++ b/sapl/audiencia/migrations/0020_auto_20251201_1450.py @@ -0,0 +1,28 @@ +# Generated by Django 2.2.28 on 2025-12-01 17:50 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('audiencia', '0019_auto_20240711_1400'), + ] + + operations = [ + migrations.AlterField( + model_name='audienciapublica', + name='ano', + field=models.PositiveSmallIntegerField(choices=[(2026, 2026), (2025, 2025), (2024, 2024), (2023, 2023), (2022, 2022), (2021, 2021), (2020, 2020), (2019, 2019), (2018, 2018), (2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), + ), + migrations.AlterField( + model_name='audienciapublica', + name='nome', + field=models.CharField(max_length=250, verbose_name='Nome da Audiência Pública'), + ), + migrations.AlterField( + model_name='audienciapublica', + name='tema', + field=models.CharField(max_length=250, verbose_name='Tema da Audiência Pública'), + ), + ] diff --git a/sapl/audiencia/models.py b/sapl/audiencia/models.py index e5d011762..6b74cffd0 100755 --- a/sapl/audiencia/models.py +++ b/sapl/audiencia/models.py @@ -65,9 +65,9 @@ class AudienciaPublica(models.Model): ano = models.PositiveSmallIntegerField(verbose_name=_('Ano'), choices=RANGE_ANOS) nome = models.CharField( - max_length=100, verbose_name=_('Nome da Audiência Pública')) + max_length=250, verbose_name=_('Nome da Audiência Pública')) tema = models.CharField( - max_length=100, verbose_name=_('Tema da Audiência Pública')) + max_length=250, verbose_name=_('Tema da Audiência Pública')) data = models.DateField(verbose_name=_('Data')) hora_inicio = models.CharField( max_length=5, verbose_name=_('Horário Início(hh:mm)')) From e7e9a2bc937be22f7af33e91502eb6adc1737b3f Mon Sep 17 00:00:00 2001 From: Edward Oliveira Date: Mon, 1 Dec 2025 15:31:54 -0300 Subject: [PATCH 3/8] Aumento de nome de parlamentar --- .../migrations/0045_auto_20251201_1531.py | 23 +++++++++++++++++++ sapl/parlamentares/models.py | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 sapl/parlamentares/migrations/0045_auto_20251201_1531.py diff --git a/sapl/parlamentares/migrations/0045_auto_20251201_1531.py b/sapl/parlamentares/migrations/0045_auto_20251201_1531.py new file mode 100644 index 000000000..2b04bc989 --- /dev/null +++ b/sapl/parlamentares/migrations/0045_auto_20251201_1531.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.28 on 2025-12-01 18:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('parlamentares', '0044_adiciona_cargos_mesa'), + ] + + operations = [ + migrations.AlterField( + model_name='parlamentar', + name='nome_completo', + field=models.CharField(max_length=80, verbose_name='Nome Completo'), + ), + migrations.AlterField( + model_name='parlamentar', + name='nome_parlamentar', + field=models.CharField(max_length=80, verbose_name='Nome Parlamentar'), + ), + ] diff --git a/sapl/parlamentares/models.py b/sapl/parlamentares/models.py index de451b555..eecc2f314 100644 --- a/sapl/parlamentares/models.py +++ b/sapl/parlamentares/models.py @@ -206,9 +206,9 @@ class Parlamentar(models.Model): on_delete=models.PROTECT, verbose_name=_('Situação Militar')) nome_completo = models.CharField( - max_length=50, verbose_name=_('Nome Completo')) + max_length=80, verbose_name=_('Nome Completo')) nome_parlamentar = models.CharField( - max_length=50, + max_length=80, verbose_name=_('Nome Parlamentar')) sexo = models.CharField( max_length=1, verbose_name=_('Sexo'), choices=SEXO_CHOICE) From 012dad004d412a329fefe44462f88d8ad1757eec Mon Sep 17 00:00:00 2001 From: Edward Oliveira Date: Mon, 1 Dec 2025 15:35:15 -0300 Subject: [PATCH 4/8] =?UTF-8?q?Invers=C3=A3o=20da=20ordem=20de=20ano=20e?= =?UTF-8?q?=20n=C3=BAmero=20em=20Adicionar=20Norma?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/templates/norma/layouts.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapl/templates/norma/layouts.yaml b/sapl/templates/norma/layouts.yaml index a44445bfb..733c3eb8d 100644 --- a/sapl/templates/norma/layouts.yaml +++ b/sapl/templates/norma/layouts.yaml @@ -32,7 +32,7 @@ AnexoNormaJuridica: NormaJuridicaCreate: {% trans 'Identificação Básica' %}: - - orgao tipo:5 numero:2 ano:2 + - orgao tipo:5 ano:2 numero:2 - data esfera_federacao complemento - tipo_materia numero_materia ano_materia - data_publicacao veiculo_publicacao data_vigencia pagina_inicio_publicacao pagina_fim_publicacao From c1614a76a85e62c20abb9948020b8458ff8bf7a1 Mon Sep 17 00:00:00 2001 From: Edward Oliveira Date: Mon, 1 Dec 2025 16:55:53 -0300 Subject: [PATCH 5/8] =?UTF-8?q?Coloca=20negrito=20em=20resultado=20de=20vo?= =?UTF-8?q?ta=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/templates/sessao/blocos_ata/materias_expediente.html | 2 +- sapl/templates/sessao/blocos_ata/materias_ordem_dia.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sapl/templates/sessao/blocos_ata/materias_expediente.html b/sapl/templates/sessao/blocos_ata/materias_expediente.html index 63cbb8291..8168ccb84 100644 --- a/sapl/templates/sessao/blocos_ata/materias_expediente.html +++ b/sapl/templates/sessao/blocos_ata/materias_expediente.html @@ -24,7 +24,7 @@ Abstenções: {{ m.voto_abstencoes }}, {% endif %} {% endif %} - Resultado: {{ m.resultado }} + Resultado: {{ m.resultado }} {% if m.resultado_observacao %} - Obs.: {{ m.resultado_observacao }} {% endif %} {% if m.voto_nominal %} Votos Nominais : diff --git a/sapl/templates/sessao/blocos_ata/materias_ordem_dia.html b/sapl/templates/sessao/blocos_ata/materias_ordem_dia.html index 8f14181cc..92ee3789b 100644 --- a/sapl/templates/sessao/blocos_ata/materias_ordem_dia.html +++ b/sapl/templates/sessao/blocos_ata/materias_ordem_dia.html @@ -25,7 +25,7 @@ Abstenções: {{ m.voto_abstencoes }}, {% endif %} {% endif %} - Resultado: {{ m.resultado }} + Resultado: {{ m.resultado }} {% if m.resultado_observacao %} - Obs.: {{ m.resultado_observacao }} {% endif %} {% if m.voto_nominal %} Votos Nominais : From c926b75c05e63b214184e1a292565df56d80e8dd Mon Sep 17 00:00:00 2001 From: Edward Oliveira Date: Sun, 14 Dec 2025 16:01:47 -0300 Subject: [PATCH 6/8] Hot-fix: conserta erro em JS de voto individual --- sapl/painel/views.py | 10 ++++++---- .../{voto_nominal.html => voto_individual.html} | 11 +++++------ 2 files changed, 11 insertions(+), 10 deletions(-) rename sapl/templates/painel/{voto_nominal.html => voto_individual.html} (97%) diff --git a/sapl/painel/views.py b/sapl/painel/views.py index a4c9e2da3..cea4e2870 100644 --- a/sapl/painel/views.py +++ b/sapl/painel/views.py @@ -93,7 +93,7 @@ def votacao_aberta(request): return votacoes_abertas.first(), None -def votacao(context,context_vars): +def votacao(context, context_vars): logger = logging.getLogger(__name__) parlamentar = context_vars['votante'].parlamentar parlamentar_presente = False @@ -204,7 +204,7 @@ def votante_view(request): username = request.user.username if request.user.is_authenticated else 'AnonymousUser' # Pega o votante relacionado ao usuário - template_name = 'painel/voto_nominal.html' + template_name = 'painel/voto_individual.html' context = {} context_vars = {} @@ -237,13 +237,15 @@ def votante_view(request): if request.method == 'POST': if context_vars['ordem_dia']: try: - logger.info("user=" + username + ". Tentando obter objeto VotoParlamentar para parlamentar={} e ordem={}." + logger.info("user=" + username + ". Tentando obter objeto VotoParlamentar para parlamentar={} e " + "ordem={}. " .format(context_vars['parlamentar'], context_vars['ordem_dia'])) voto = VotoParlamentar.objects.get( parlamentar=context_vars['parlamentar'], ordem=context_vars['ordem_dia']) except ObjectDoesNotExist: - logger.error("user=" + username + ". Erro ao obter VotoParlamentar para parlamentar={} e ordem={}. Criando objeto." + logger.error("user=" + username + ". Erro ao obter VotoParlamentar para parlamentar={} e ordem={}. " + "Criando objeto. " .format(context_vars['parlamentar'], context_vars['ordem_dia'])) voto = VotoParlamentar.objects.create( parlamentar=context_vars['parlamentar'], diff --git a/sapl/templates/painel/voto_nominal.html b/sapl/templates/painel/voto_individual.html similarity index 97% rename from sapl/templates/painel/voto_nominal.html rename to sapl/templates/painel/voto_individual.html index ecd915c25..c35daa5fa 100644 --- a/sapl/templates/painel/voto_nominal.html +++ b/sapl/templates/painel/voto_individual.html @@ -132,9 +132,6 @@ {% render_bundle 'painel' 'js' %} {% endblock extra_js %}