From f8f3d6ce5bd90ffb0a5e4e732e8aadaa3809fcee Mon Sep 17 00:00:00 2001 From: madjid-asa Date: Mon, 29 Apr 2024 12:07:36 +0200 Subject: [PATCH] =?UTF-8?q?feat(D=C3=A9p=C3=B4t=20de=20besoins):=20renomme?= =?UTF-8?q?r=20les=20titres=20d'emails=20pour=20ne=20pas=20avoir=20l'impre?= =?UTF-8?q?ssion=20d'envoyer=20deux=20fois=20le=20m=C3=AAme=20mail=20(#116?= =?UTF-8?q?6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lemarche/www/tenders/tasks.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lemarche/www/tenders/tasks.py b/lemarche/www/tenders/tasks.py index 42af827e1..f7f8b424d 100644 --- a/lemarche/www/tenders/tasks.py +++ b/lemarche/www/tenders/tasks.py @@ -8,6 +8,7 @@ from sesame.utils import get_query_string as sesame_get_query_string from lemarche.siaes.models import Siae +from lemarche.tenders import constants as tender_constants from lemarche.tenders.models import PartnerShareTender, Tender, TenderSiae from lemarche.users.models import User from lemarche.utils import constants @@ -65,15 +66,20 @@ def send_tender_emails_to_siaes(tender: Tender): previous email_subject: f"{tender.get_kind_display()} : {tender.title} ({tender.author.company_name})" """ - email_subject = "J'ai une opportunité commerciale pour vous sur le Marché de l'inclusion" - siae_users_count = 0 - siae_users_send_count = 0 + if tender.source == tender_constants.SOURCE_TALLY: + tender_title_splitted = " ".join(tender.title.split()[:3]) + email_subject = f"{tender.get_kind_display()} : {tender_title_splitted}..." + else: + email_subject = "J'ai une opportunité commerciale pour vous sur le Marché de l'inclusion" # queryset all_siaes = tender.siaes.filter(tendersiae__email_send_date=None).order_by_super_siaes() logger.info(f"total siaes {all_siaes.count()}") siaes = all_siaes[: tender.limit_send_to_siae_batch] + siae_users_count = 0 + siae_users_send_count = 0 + for siae in siaes: # send to siae 'contact_email' send_tender_email_to_siae(tender, siae, email_subject)