diff --git a/sigi/apps/servicos/jobs/__init__.py b/sigi/apps/servicos/jobs/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sigi/apps/servicos/jobs/daily/__init__.py b/sigi/apps/servicos/jobs/daily/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sigi/apps/servicos/jobs/daily/atualiza_uso_servicos.py b/sigi/apps/servicos/jobs/daily/atualiza_uso_servicos.py new file mode 100644 index 0000000..508a489 --- /dev/null +++ b/sigi/apps/servicos/jobs/daily/atualiza_uso_servicos.py @@ -0,0 +1,20 @@ +import datetime +from django_extensions.management.jobs import DailyJob +from sigi.apps.servicos.models import Servico + + +class Job(DailyJob): + help = "Atualiza uso dos serviços" + + def execute(self): + print( + "Atualizando uso dos serviços SEIT." + f" Início: {datetime.datetime.now(): %d/%m/%Y %H:%M:%S}", + end=" ", + ) + queryset = Servico.objects.exclude(url="").exclude( + tipo_servico__string_pesquisa="" + ) + for obj in queryset: + obj.atualiza_data_uso() + print(f"Término: {datetime.datetime.now(): %d/%m/%Y %H:%M:%S}") diff --git a/sigi/apps/servicos/jobs/hourly/__init__.py b/sigi/apps/servicos/jobs/hourly/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sigi/apps/servicos/jobs/monthly/__init__.py b/sigi/apps/servicos/jobs/monthly/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sigi/apps/servicos/jobs/weekly/__init__.py b/sigi/apps/servicos/jobs/weekly/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sigi/apps/servicos/jobs/yearly/__init__.py b/sigi/apps/servicos/jobs/yearly/__init__.py new file mode 100644 index 0000000..e69de29