feat
This commit is contained in:
parent
1e00db93fa
commit
01161efec6
20
main.ipynb
20
main.ipynb
@ -564,11 +564,21 @@
|
||||
" )\n",
|
||||
" if exhibition_finished:\n",
|
||||
" exhibition_id_str = str(exhibition_finished[\"_id\"])\n",
|
||||
" cursor = delivery_collection.aggregate([\n",
|
||||
" {\"$match\": {\n",
|
||||
" \"exhibition_id\": exhibition_id_str, **prod_filter\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",
|
||||
" async for doc in delivery_collection.find(\n",
|
||||
" {\"exhibition_id\": exhibition_id_str, \"status\": \"Получено\", **prod_filter},\n",
|
||||
" {\"_id\": 0},\n",
|
||||
" ):\n",
|
||||
" data = [doc async for doc in cursor if doc.status == 'На выставке']\n",
|
||||
" for doc in data:\n",
|
||||
" sender = doc.get(\"sender\")\n",
|
||||
" post_id = doc.get(\"post_id\")\n",
|
||||
" exhibition_id = doc.get(\"exhibition_id\")\n",
|
||||
@ -4858,7 +4868,7 @@
|
||||
" ],\n",
|
||||
" 'prod': PROD,\n",
|
||||
" }},\n",
|
||||
" {\"$sort\": {\"_id\": -1}}, # why not work\n",
|
||||
" {\"$sort\": {\"_id\": -1}},\n",
|
||||
" {\"$group\": {\n",
|
||||
" \"_id\": \"$post_id\",\n",
|
||||
" \"doc\": {\"$first\": \"$$ROOT\"}\n",
|
||||
|
||||
20
main.py
20
main.py
@ -352,11 +352,21 @@ async def cron_every_five_min(token: str = Security(get_token)):
|
||||
)
|
||||
if exhibition_finished:
|
||||
exhibition_id_str = str(exhibition_finished["_id"])
|
||||
cursor = delivery_collection.aggregate([
|
||||
{"$match": {
|
||||
"exhibition_id": exhibition_id_str, **prod_filter
|
||||
}},
|
||||
{"$sort": {"_id": -1}},
|
||||
{"$group": {
|
||||
"_id": "$post_id",
|
||||
"doc": {"$first": "$$ROOT"}
|
||||
}},
|
||||
{"$replaceRoot": {"newRoot": "$doc"}},
|
||||
{"$sort": {"_id": -1}},
|
||||
])
|
||||
|
||||
async for doc in delivery_collection.find(
|
||||
{"exhibition_id": exhibition_id_str, "status": "Получено", **prod_filter},
|
||||
{"_id": 0},
|
||||
):
|
||||
data = [doc async for doc in cursor if doc.status == 'На выставке']
|
||||
for doc in data:
|
||||
sender = doc.get("sender")
|
||||
post_id = doc.get("post_id")
|
||||
exhibition_id = doc.get("exhibition_id")
|
||||
@ -3727,7 +3737,7 @@ async def profile_delivery(
|
||||
],
|
||||
'prod': PROD,
|
||||
}},
|
||||
{"$sort": {"_id": -1}}, # why not work
|
||||
{"$sort": {"_id": -1}},
|
||||
{"$group": {
|
||||
"_id": "$post_id",
|
||||
"doc": {"$first": "$$ROOT"}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user