From ffd6704a91b6f5e789cb8a28429d8e3d4792ef03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Odini?= Date: Wed, 17 Apr 2024 16:33:43 +0200 Subject: [PATCH] =?UTF-8?q?fix(Besoins):=20=C3=A9vite=20d'envoyer=20des=20?= =?UTF-8?q?mails=20de=20relance=20aux=20structures=20pas=20int=C3=A9ress?= =?UTF-8?q?=C3=A9es=20(#1158)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- clevercloud/tenders_send_siae_contacted_reminder_emails.sh | 2 -- .../commands/send_siae_contacted_reminder_emails.py | 7 +++---- .../commands/send_siae_interested_reminder_emails.py | 6 +++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/clevercloud/tenders_send_siae_contacted_reminder_emails.sh b/clevercloud/tenders_send_siae_contacted_reminder_emails.sh index db4a3eb44..0c135f3e5 100755 --- a/clevercloud/tenders_send_siae_contacted_reminder_emails.sh +++ b/clevercloud/tenders_send_siae_contacted_reminder_emails.sh @@ -20,5 +20,3 @@ fi cd $APP_HOME django-admin send_siae_contacted_reminder_emails --days-since-email-send-date 2 -django-admin send_siae_contacted_reminder_emails --days-since-email-send-date 3 -django-admin send_siae_contacted_reminder_emails --days-since-email-send-date 4 diff --git a/lemarche/tenders/management/commands/send_siae_contacted_reminder_emails.py b/lemarche/tenders/management/commands/send_siae_contacted_reminder_emails.py index b85d80b28..f2f0c901c 100644 --- a/lemarche/tenders/management/commands/send_siae_contacted_reminder_emails.py +++ b/lemarche/tenders/management/commands/send_siae_contacted_reminder_emails.py @@ -37,7 +37,7 @@ def handle(self, dry_run=False, **options): self.stdout.write("Script to send Siae contacted reminder emails...") current_weekday = timezone.now().weekday() - if current_weekday >= 5: + if current_weekday > 4: self.stdout.write("Weekend... Stopping. Come back on Monday :)") else: self.stdout.write("-" * 80) @@ -47,10 +47,9 @@ def handle(self, dry_run=False, **options): lt_days_ago = timezone.now() - timedelta(days=options["days_since_email_send_date"]) gte_days_ago = timezone.now() - timedelta(days=options["days_since_email_send_date"] + 1) - # Monday: special case (the script doesn't run on weekends) - # gte_days_ago = gte_days_ago+2 to account for Saturday & Sunday + # The script doesn't run on weekends if current_weekday == 0: - gte_days_ago = timezone.now() - timedelta(days=options["days_since_email_send_date"] + 1 + 2) + gte_days_ago = gte_days_ago - timedelta(days=2) tendersiae_contacted_reminder_list = TenderSiae.objects.email_click_reminder( gte_days_ago=gte_days_ago, lt_days_ago=lt_days_ago ) diff --git a/lemarche/tenders/management/commands/send_siae_interested_reminder_emails.py b/lemarche/tenders/management/commands/send_siae_interested_reminder_emails.py index 60ab02d37..10a9fdc23 100644 --- a/lemarche/tenders/management/commands/send_siae_interested_reminder_emails.py +++ b/lemarche/tenders/management/commands/send_siae_interested_reminder_emails.py @@ -37,7 +37,7 @@ def handle(self, dry_run=False, **options): self.stdout.write("Script to send Siae interested reminder emails...") current_weekday = timezone.now().weekday() - if current_weekday >= 5: + if current_weekday > 4: self.stdout.write("Weekend... Stopping. Come back on Monday :)") else: self.stdout.write("-" * 80) @@ -46,10 +46,10 @@ def handle(self, dry_run=False, **options): lt_days_ago = timezone.now() - timedelta(days=options["days_since_detail_contact_click_date"]) gte_days_ago = timezone.now() - timedelta(days=options["days_since_detail_contact_click_date"] + 1) - # Monday: special case (the script doesn't run during on weekends) + # Monday: special case (the script doesn't run on weekends) # gte_days_ago = gte_days_ago+2 to account for Saturday & Sunday if current_weekday == 0: - gte_days_ago = timezone.now() - timedelta(days=options["days_since_detail_contact_click_date"] + 1 + 2) + gte_days_ago = gte_days_ago - timedelta(days=2) tendersiae_interested_reminder_list = TenderSiae.objects.detail_contact_click_post_reminder( gte_days_ago=gte_days_ago, lt_days_ago=lt_days_ago )