fix
This commit is contained in:
parent
590377afe9
commit
2ecdeadf4a
41
main.ipynb
41
main.ipynb
@ -4584,6 +4584,46 @@
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "d68edb20",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"@app.get('/profile/delivery/exhibition/{exhibition_id}')\n",
|
||||
"async def profile_delivery_by_exhibition(request: Request, exhibition_id:str, user: Dict = Security(get_current_user)):\n",
|
||||
" cursor = delivery_collection.aggregate([\n",
|
||||
" {\"$match\": {\n",
|
||||
" \"$or\": [\n",
|
||||
" {\"sender._id\": user.get('_id')},\n",
|
||||
" {\"user._id\": user.get('_id')},\n",
|
||||
" {\"receiver._id\": user.get('_id')}\n",
|
||||
" ],\n",
|
||||
" 'exhibition_id': ObjectId(exhibition_id),\n",
|
||||
" 'prod': PROD,\n",
|
||||
" }},\n",
|
||||
" {\"$sort\": {\"_id\": -1}},\n",
|
||||
" {\"$group\": {\n",
|
||||
" \"_id\": \"$post_id\",\n",
|
||||
" \"doc\": {\"$first\": \"$$ROOT\"}\n",
|
||||
" }},\n",
|
||||
" {\"$replaceRoot\": {\"newRoot\": \"$doc\"}},\n",
|
||||
" {\"$sort\": {\"_id\": -1}},\n",
|
||||
" ])\n",
|
||||
"\n",
|
||||
" data = [doc async for doc in cursor]\n",
|
||||
" return templates.TemplateResponse(\n",
|
||||
" request=request,\n",
|
||||
" name=\"profile/delivery_old.html\",\n",
|
||||
" context={\n",
|
||||
" \"user\": user,\n",
|
||||
" \"data\": data,\n",
|
||||
" }\n",
|
||||
" )\n"
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@ -4650,6 +4690,7 @@
|
||||
" \"exhibitions\": exhibitions,\n",
|
||||
" \"competitions\": competitions,\n",
|
||||
" \"data\": data,\n",
|
||||
" \"now\": datetime.now(),\n",
|
||||
" \"page_title\": \"Доставка\",\n",
|
||||
" \"active_section\": \"delivery\"\n",
|
||||
" }\n",
|
||||
|
||||
33
main.py
33
main.py
@ -3487,6 +3487,38 @@ async def profile_delivery_by_competition(request: Request, competition_id:str,
|
||||
)
|
||||
|
||||
|
||||
@app.get('/profile/delivery/exhibition/{exhibition_id}')
|
||||
async def profile_delivery_by_exhibition(request: Request, exhibition_id:str, user: Dict = Security(get_current_user)):
|
||||
cursor = delivery_collection.aggregate([
|
||||
{"$match": {
|
||||
"$or": [
|
||||
{"sender._id": user.get('_id')},
|
||||
{"user._id": user.get('_id')},
|
||||
{"receiver._id": user.get('_id')}
|
||||
],
|
||||
'exhibition_id': ObjectId(exhibition_id),
|
||||
'prod': PROD,
|
||||
}},
|
||||
{"$sort": {"_id": -1}},
|
||||
{"$group": {
|
||||
"_id": "$post_id",
|
||||
"doc": {"$first": "$$ROOT"}
|
||||
}},
|
||||
{"$replaceRoot": {"newRoot": "$doc"}},
|
||||
{"$sort": {"_id": -1}},
|
||||
])
|
||||
|
||||
data = [doc async for doc in cursor]
|
||||
return templates.TemplateResponse(
|
||||
request=request,
|
||||
name="profile/delivery_old.html",
|
||||
context={
|
||||
"user": user,
|
||||
"data": data,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@app.get(
|
||||
"/profile/delivery",
|
||||
response_class=HTMLResponse,
|
||||
@ -3546,6 +3578,7 @@ async def profile_delivery(
|
||||
"exhibitions": exhibitions,
|
||||
"competitions": competitions,
|
||||
"data": data,
|
||||
"now": datetime.now(),
|
||||
"page_title": "Доставка",
|
||||
"active_section": "delivery"
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user