From 33ad3975e57a8843041515d8a30f274ee6be32a8 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Mon, 19 Feb 2024 15:17:25 +0100 Subject: [PATCH] Additional fixes (filter on tender without transaction info) --- .../commands/send_siae_transactioned_question_emails.py | 9 ++++----- lemarche/www/tenders/tasks.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lemarche/tenders/management/commands/send_siae_transactioned_question_emails.py b/lemarche/tenders/management/commands/send_siae_transactioned_question_emails.py index b2fc622bf..2a9feb681 100644 --- a/lemarche/tenders/management/commands/send_siae_transactioned_question_emails.py +++ b/lemarche/tenders/management/commands/send_siae_transactioned_question_emails.py @@ -13,9 +13,7 @@ class Command(BaseCommand): """ Daily script to send an email to tender siaes Rules - - Tender must be "sent" - - Siae must be "interested" - - Siae must not have received a survey yet + - Tender must be "sent" + no info on "transactioned" When? - J+7 after tender start_working_date @@ -31,8 +29,9 @@ def add_arguments(self, parser): def handle(self, kind=None, reminder=False, dry_run=False, **options): self.stdout.write("Script to send email tender transactioned_question to interested siaes...") - # tender must be sent & start_working_date J+7 - tender_qs = Tender.objects.sent().filter(start_working_date=seven_days_ago) + # tender must be sent & no info on transaction & start_working_date J+7 + tender_qs = Tender.objects.sent().filter(siae_transactioned=None) + tender_qs = tender_qs.filter(start_working_date=seven_days_ago) self.stdout.write(f"Found {tender_qs.count()} tenders") diff --git a/lemarche/www/tenders/tasks.py b/lemarche/www/tenders/tasks.py index 46ac3767a..37b2d3e0d 100644 --- a/lemarche/www/tenders/tasks.py +++ b/lemarche/www/tenders/tasks.py @@ -609,7 +609,7 @@ def send_tenders_siae_survey(tendersiae: TenderSiae, kind="transactioned_questio # add timestamp tendersiae.survey_transactioned_send_date = timezone.now() - api_mailjet.send_transactional_email_many_recipient_with_template( + api_mailjet.send_transactional_email_with_template( template_id=template_id, subject=email_subject, recipient_email=recipient_email,