From a8c24447ed1d25257889fbc84e6cfa7987f32082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Tue, 26 Sep 2023 12:24:40 -0300 Subject: [PATCH] =?UTF-8?q?Corrigido=20bug=20detectado=20na=20homologa?= =?UTF-8?q?=C3=A7=C3=A3o=20gertiq=20#164983?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/eventos/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sigi/apps/eventos/models.py b/sigi/apps/eventos/models.py index e4a5e89..6205ba7 100644 --- a/sigi/apps/eventos/models.py +++ b/sigi/apps/eventos/models.py @@ -562,13 +562,15 @@ class Evento(models.Model): proximo = int(ultimo_evento.turma[:2]) + 1 self.turma = f"{proximo:02}/{ano:04}" + # É preciso salvar para poder usar o relacionamento com convites # + super().save(*args, **kwargs) total = self.convite_set.aggregate(total=Sum("qtde_participantes"))[ "total" ] - if total and total > 0: + if total and total > 0 and total != self.total_participantes: self.total_participantes = total - - super().save(*args, **kwargs) + # Salva de novo se o total de participantes mudou # + super().save(*args, **kwargs) if self.status in [ Evento.STATUS_PLANEJAMENTO,