From 59bc25f31ceba8ba903adc42db2f8b8e00e1bae3 Mon Sep 17 00:00:00 2001 From: SDE Date: Tue, 16 Jan 2024 17:25:40 +0300 Subject: [PATCH] 0.11.21 push w link --- RoutesApp/search_matches.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/RoutesApp/search_matches.py b/RoutesApp/search_matches.py index 3c8e689..81b1994 100644 --- a/RoutesApp/search_matches.py +++ b/RoutesApp/search_matches.py @@ -8,6 +8,7 @@ from BaseModels.mailSender import admin_send_mail_by_SMTPlib, techSendMail def get_Dict_for_send_msgs(kwargs, search_owner_type): + print('get_Dict_for_send_msgs') Dict = { 'search_owner_type': search_owner_type @@ -30,6 +31,8 @@ def get_Dict_for_send_msgs(kwargs, search_owner_type): def send_push_message_for_found_matches_routes(route, data_Dict): + print(f'send_push_message_for_found_matches_routes to route id = {route.id}') + if not route.owner.is_authenticated: return None @@ -42,6 +45,7 @@ def send_push_message_for_found_matches_routes(route, data_Dict): def send_mail_found_matches_routes(route, data_Dict): + print(f'send_mail_found_matches_routes to route id = {route.id}') Dict = { 'route': route, @@ -65,6 +69,7 @@ def send_mail_found_matches_routes(route, data_Dict): def search_matches(for_routes=None): + print('search_matches') log = '' @@ -80,6 +85,11 @@ def search_matches(for_routes=None): 'from_place', 'to_place', 'cargo_type', 'weight' ] + if for_routes: + msg = f'last hour create routes count = {for_routes.count()}' + else: + msg = f'last hour not create routes' + print(msg) for route in for_routes: kwargs = {} @@ -114,6 +124,8 @@ def search_matches(for_routes=None): ) if found_routes: + msg = f'found routes for send messages = {found_routes.count()}' + data_Dict = get_Dict_for_send_msgs(params, found_routes[0].owner_type) msg = send_push_message_for_found_matches_routes(route, data_Dict) if msg: @@ -124,6 +136,7 @@ def search_matches(for_routes=None): except Exception as e: msg = f'
\n! search_matches Error = {str(e)}' + print(msg) log += msg mail_sets = get_mail_send_options()