send confirmation info by signal

This commit is contained in:
2023-10-25 18:35:27 +02:00
parent 2ff4e1fd8e
commit cf7155f9fb
5 changed files with 57 additions and 13 deletions
Regular → Executable
+9 -4
View File
@@ -11,13 +11,14 @@ from src.db.mirgration.migration_tools import migre_accepted_appointment
from src.db.mongo_manager import MONGO_STORE_MANAGER
from src.mail.mail_constants import create_imap, show_folders
from src.notification.AcceptedResultPojo import get_accepted_result_from
from src.notification.SignalSender import SignalSender
from src.notification.mailer import Mailer
from src.pojo.ResultEnum import ResultEnum
from src.pojo.mail.mail_pojo import MailPojo
from src.pojo.mail.mail_pojo import MailPojo, MailAddress
from src.utils.excel_reader import ExcelHelper
CONFIRMATION_SUBJECT_FR = 'Votre rendez-vous est'
CONFIRMATION_SUBJECT_EN = 'appointment is confirmed'
CONFIRMATION_SUBJECT_FR = 'rendez-vous est'
CONFIRMATION_SUBJECT_EN = 'confirmed'
HERMES_EMAIL = "no-reply@hermes.com"
date_format = "%d-%b-%Y" # DD-Mon-YYYY e.g., 3-Mar-2014
@@ -145,10 +146,13 @@ def clean(text):
def accept_appointment_found(accepted_result_list: list):
mailer = Mailer()
sginal = SignalSender()
print(accepted_result_list)
for reserve in accepted_result_list:
mailer.send_email(get_accepted_result_from(reserve, MONGO_STORE_MANAGER), to_all=True)
result = get_accepted_result_from(reserve, MONGO_STORE_MANAGER)
mailer.send_email(result, to_all=False)
MONGO_STORE_MANAGER.update_reserve_result(reserve.id, ResultEnum.ACCEPTED, reserve.message)
sginal.send_result(result)
if len(accepted_result_list) > 0:
migre_accepted_appointment(str(datetime.date.today()))
@@ -156,6 +160,7 @@ def accept_appointment_found(accepted_result_list: list):
def read_mails_and_find_confirmation_contacts():
mail_list = MONGO_STORE_MANAGER.get_destination_emails()
mail_list.reverse()
# excel_reader = ExcelHelper()
# mail_list =excel_reader.read_email_pojo(file_name="/Users/lpan/Desktop/hotmail_list.xlsx")
# mail_address3 = MailAddress(mail="taibenchragu1978@onet.pl", password="2J)kyfNgyOZ")