From 2f9b382c65214779cb1c0d308028ca7398c5caf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Fri, 23 Sep 2022 10:01:02 -0300 Subject: [PATCH] =?UTF-8?q?Acrescenta=20job=20importa=C3=A7=C3=A3o=20Gesco?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/convenios/jobs/__init__.py | 0 sigi/apps/convenios/jobs/daily/__init__.py | 0 sigi/apps/convenios/jobs/daily/importa_gescon.py | 15 +++++++++++++++ sigi/apps/convenios/jobs/hourly/__init__.py | 0 sigi/apps/convenios/jobs/monthly/__init__.py | 0 sigi/apps/convenios/jobs/weekly/__init__.py | 0 sigi/apps/convenios/jobs/yearly/__init__.py | 0 7 files changed, 15 insertions(+) create mode 100644 sigi/apps/convenios/jobs/__init__.py create mode 100644 sigi/apps/convenios/jobs/daily/__init__.py create mode 100644 sigi/apps/convenios/jobs/daily/importa_gescon.py create mode 100644 sigi/apps/convenios/jobs/hourly/__init__.py create mode 100644 sigi/apps/convenios/jobs/monthly/__init__.py create mode 100644 sigi/apps/convenios/jobs/weekly/__init__.py create mode 100644 sigi/apps/convenios/jobs/yearly/__init__.py diff --git a/sigi/apps/convenios/jobs/__init__.py b/sigi/apps/convenios/jobs/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sigi/apps/convenios/jobs/daily/__init__.py b/sigi/apps/convenios/jobs/daily/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sigi/apps/convenios/jobs/daily/importa_gescon.py b/sigi/apps/convenios/jobs/daily/importa_gescon.py new file mode 100644 index 0000000..cc79e72 --- /dev/null +++ b/sigi/apps/convenios/jobs/daily/importa_gescon.py @@ -0,0 +1,15 @@ +from django_extensions.management.jobs import DailyJob +from sigi.apps.convenios.models import Gescon +import datetime + + +class Job(DailyJob): + help = "Carga de dados do Gescon." + + def execute(self): + now = datetime.datetime.now() + print(f"Import gescon data started at {now:%Y-%m-%d %H:%M:%S}") + gescon = Gescon.load() + gescon.importa_contratos() + now = datetime.datetime.now() + print(f"Import gescon data finished at {now:%Y-%m-%d %H:%M:%S}") diff --git a/sigi/apps/convenios/jobs/hourly/__init__.py b/sigi/apps/convenios/jobs/hourly/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sigi/apps/convenios/jobs/monthly/__init__.py b/sigi/apps/convenios/jobs/monthly/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sigi/apps/convenios/jobs/weekly/__init__.py b/sigi/apps/convenios/jobs/weekly/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sigi/apps/convenios/jobs/yearly/__init__.py b/sigi/apps/convenios/jobs/yearly/__init__.py new file mode 100644 index 0000000..e69de29