fix
This commit is contained in:
parent
c096b04389
commit
4e877755b0
28
main.ipynb
28
main.ipynb
@ -4553,11 +4553,26 @@
|
||||
"source": [
|
||||
"@app.get('/profile/delivery/competition/{competition_id}')\n",
|
||||
"async def profile_delivery_by_competition(request: Request, competition_id:str, user: Dict = Security(get_current_user)):\n",
|
||||
" data = await delivery_collection.find({'competition_id': ObjectId(competition_id), \"$or\": [\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",
|
||||
" ]}).sort('_id', -1).to_list()\n",
|
||||
" ],\n",
|
||||
" 'competition_id': ObjectId(competition_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",
|
||||
@ -4569,15 +4584,6 @@
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "c099d5df",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
|
||||
21
main.py
21
main.py
@ -3457,11 +3457,26 @@ async def profile_delivery_history_post(request: Request, post_id:str, user: Dic
|
||||
|
||||
@app.get('/profile/delivery/competition/{competition_id}')
|
||||
async def profile_delivery_by_competition(request: Request, competition_id:str, user: Dict = Security(get_current_user)):
|
||||
data = await delivery_collection.find({'competition_id': ObjectId(competition_id), "$or": [
|
||||
cursor = delivery_collection.aggregate([
|
||||
{"$match": {
|
||||
"$or": [
|
||||
{"sender._id": user.get('_id')},
|
||||
{"user._id": user.get('_id')},
|
||||
{"receiver._id": user.get('_id')}
|
||||
]}).sort('_id', -1).to_list()
|
||||
],
|
||||
'competition_id': ObjectId(competition_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",
|
||||
@ -3472,8 +3487,6 @@ async def profile_delivery_by_competition(request: Request, competition_id:str,
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@app.get(
|
||||
"/profile/delivery",
|
||||
response_class=HTMLResponse,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user