diff --git a/main.ipynb b/main.ipynb index 5a85ded..978aa16 100644 --- a/main.ipynb +++ b/main.ipynb @@ -4998,8 +4998,8 @@ " \n", " data = [doc async for doc in get_delivery_aggregate(_match)]\n", "\n", - " exhibitions = await exhibition_collection.find({'_id': {'$in': [ObjectId(i.get('exhibition_id')) for i in data if i.get('exhibition_id')]}}).to_list()\n", - " competitions = await competitions_col.find({'_id': {'$in': [i.get('competition_id') for i in data if i.get('competition_id')]}}).to_list()\n", + " exhibitions = await exhibition_collection.find({'_id': {'$in': [ObjectId(i.get('exhibition_id')) for i in data if i.get('exhibition_id')]}}).sort(\"_id\", -1).to_list()\n", + " competitions = await competitions_col.find({'_id': {'$in': [i.get('competition_id') for i in data if i.get('competition_id')]}}).sort(\"_id\", -1).to_list()\n", " return templates.TemplateResponse(\n", " request=request,\n", " name=\"profile/delivery.html\",\n", diff --git a/main.py b/main.py index fd3ab3c..9756cf0 100644 --- a/main.py +++ b/main.py @@ -3818,8 +3818,8 @@ async def profile_delivery( data = [doc async for doc in get_delivery_aggregate(_match)] - exhibitions = await exhibition_collection.find({'_id': {'$in': [ObjectId(i.get('exhibition_id')) for i in data if i.get('exhibition_id')]}}).to_list() - competitions = await competitions_col.find({'_id': {'$in': [i.get('competition_id') for i in data if i.get('competition_id')]}}).to_list() + exhibitions = await exhibition_collection.find({'_id': {'$in': [ObjectId(i.get('exhibition_id')) for i in data if i.get('exhibition_id')]}}).sort("_id", -1).to_list() + competitions = await competitions_col.find({'_id': {'$in': [i.get('competition_id') for i in data if i.get('competition_id')]}}).sort("_id", -1).to_list() return templates.TemplateResponse( request=request, name="profile/delivery.html",