build
This commit is contained in:
parent
e4ab7d9c1e
commit
1d279ff176
16
main.py
16
main.py
@ -1546,7 +1546,6 @@ async def partner_competition_request_artist(
|
||||
print(data)
|
||||
competition = await competitions_col.find_one({'_id':ObjectId(data.competition_id), 'user._id': current_user.get('_id')})
|
||||
if competition:
|
||||
if PROD:
|
||||
await competition_request_col.update_many(
|
||||
{'user._id': data.user_id, 'competition_id': data.competition_id},
|
||||
{'$set': {'status': True,"posts.$[].status": 'Проходит' }},
|
||||
@ -1555,14 +1554,23 @@ async def partner_competition_request_artist(
|
||||
social_vk = await social_collection.find_one({'user_id':current_user.get('_id'), 'group': {"$exists": False}, 'type':'vk'})
|
||||
user = display_user(current_user)
|
||||
user['social_vk'] = social_vk
|
||||
await invitations_collection.insert_one({
|
||||
await invitations_collection.update_one({
|
||||
"user_id": data.user_id,
|
||||
"item": competition['title'],
|
||||
"item": competition.get('title'),
|
||||
"title": "Вы прошли отбор",
|
||||
"type_": competition.get("type_"),
|
||||
"user": user,
|
||||
"prod": PROD,
|
||||
"type": "Конкурс"
|
||||
})
|
||||
},{'$set':{
|
||||
"user_id": data.user_id,
|
||||
"item": competition.get('title'),
|
||||
"title": "Вы прошли отбор",
|
||||
"type_": competition.get("type_"),
|
||||
"user": user,
|
||||
"prod": PROD,
|
||||
"type": "Конкурс"
|
||||
}},upsert=True)
|
||||
return {'ok': True}
|
||||
else:
|
||||
return {'ok': False}
|
||||
|
||||
22
tasks.py
22
tasks.py
@ -631,7 +631,7 @@ async def update_competition_req(competition, user, posts):
|
||||
# Генерация login link
|
||||
token = await token_create(
|
||||
str(user['_id']),
|
||||
url=f'/profile/delivery#main'
|
||||
url=f'/profile/invitation#main'
|
||||
)
|
||||
login_link = f'{FULL_DOMAIN}/login/{token}'
|
||||
|
||||
@ -681,7 +681,7 @@ async def update_competition_req(competition, user, posts):
|
||||
user_id=str(user['_id']),
|
||||
type_item='invitation',
|
||||
title='Приглашение',
|
||||
link=f'/profile/delivery',
|
||||
link=f'/profile/invitation',
|
||||
text=f'Вы прошли отбор на конкурсе "{competition.get("title")}"'
|
||||
))
|
||||
all_allowed = all(
|
||||
@ -692,7 +692,23 @@ async def update_competition_req(competition, user, posts):
|
||||
|
||||
# Email-уведомление
|
||||
if user.get('email') and all_allowed and has_approved:
|
||||
print([i['title'] for i in posts_sorted])
|
||||
await invitations_collection.update_one({
|
||||
"user_id": str(user['_id']),
|
||||
"item": competition.get("title"),
|
||||
"title": "Вы прошли отбор",
|
||||
"type_": competition.get("type_"),
|
||||
"user": display_user(competition_owner),
|
||||
"prod": PROD,
|
||||
"type": "Конкурс"
|
||||
},{'$set':{
|
||||
"user_id": str(user['_id']),
|
||||
"item": competition.get("title"),
|
||||
"title": "Вы прошли отбор",
|
||||
"type_": competition.get("type_"),
|
||||
"user": display_user(competition_owner),
|
||||
"prod": PROD,
|
||||
"type": "Конкурс"
|
||||
}},upsert=True)
|
||||
if PROD and user.get('email') and all_allowed and has_approved:
|
||||
email_data = {
|
||||
'text': 'Статус заявки обновлен',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user