From b64875d169c3137fdf0ea738f711b4e425808d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Tue, 24 Oct 2023 09:52:07 -0300 Subject: [PATCH] =?UTF-8?q?Ajustes=20no=20relat=C3=B3rio=20do=20job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/eventos/jobs/daily/encerra_inscricao.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sigi/apps/eventos/jobs/daily/encerra_inscricao.py b/sigi/apps/eventos/jobs/daily/encerra_inscricao.py index 709f501..107ef04 100644 --- a/sigi/apps/eventos/jobs/daily/encerra_inscricao.py +++ b/sigi/apps/eventos/jobs/daily/encerra_inscricao.py @@ -16,7 +16,7 @@ class Job(JobReportMixin, DailyJob): report_data = [] def do_job(self): - hoje = timezone.localtime() + hoje = timezone.localtime().replace(hour=23, minute=59, second=59) anteontem = hoje - timezone.timedelta(days=3) encerrar_inscricao = ( @@ -24,7 +24,8 @@ class Job(JobReportMixin, DailyJob): .filter(data_inicio__lte=hoje) .exclude(chave_inscricao=INSCRICOES_ENCERRADAS) ) - encerrar_inscricao.update(chave_inscricao=INSCRICOES_ENCERRADAS) + + total_encerrar = encerrar_inscricao.count() self.report_data.append(_("Inscrições encerradas")) self.report_data.append("---------------------") @@ -34,10 +35,12 @@ class Job(JobReportMixin, DailyJob): ) self.report_data.append("") + encerrar_inscricao.update(chave_inscricao=INSCRICOES_ENCERRADAS) + despublicar = Evento.objects.exclude(publicar=False).filter( data_termino__lte=anteontem ) - despublicar.update(publicar=False) + total_despublicar = despublicar.count() self.report_data.append(_("Despublicados")) self.report_data.append("-------------") @@ -45,19 +48,21 @@ class Job(JobReportMixin, DailyJob): self.report_data.extend([f"{e.nome} ({e.id})" for e in despublicar]) self.report_data.append("") + despublicar.update(publicar=False) + self.report_data.append(_("RESUMO")) self.report_data.append("------") self.report_data.append("") self.report_data.append( _( "* Total de eventos alterados para inscrições encerradas: " - f"{encerrar_inscricao.count()}" + f"{total_encerrar}" ) ) self.report_data.append( _( "* Total de eventos despublicados do portal: " - f"{despublicar.count()}" + f"{total_despublicar}" ) ) self.report_data.append("")