Skip to content

Commit

Permalink
fix(Besoins): évite d'envoyer des mails de relance aux structures pas…
Browse files Browse the repository at this point in the history
… intéressées (#1158)
  • Loading branch information
raphodn authored Apr 17, 2024
1 parent 2c84271 commit ffd6704
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 0 additions & 2 deletions clevercloud/tenders_send_siae_contacted_reminder_emails.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
)
Expand Down

0 comments on commit ffd6704

Please sign in to comment.