0.11.21 push w link
This commit is contained in:
@@ -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'<br>\n! search_matches Error = {str(e)}'
|
||||
print(msg)
|
||||
log += msg
|
||||
|
||||
mail_sets = get_mail_send_options()
|
||||
|
||||
Reference in New Issue
Block a user