From 9b85b270e3ad18873e8755b39e3c96f93c3691e8f8fedc74817807ff97e91098 Mon Sep 17 00:00:00 2001 From: vladislav Date: Wed, 2 Sep 2026 00:13:15 -0400 Subject: [PATCH] fix --- main.ipynb | 6 ++++++ main.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/main.ipynb b/main.ipynb index f67d044..5e77642 100644 --- a/main.ipynb +++ b/main.ipynb @@ -3277,6 +3277,12 @@ " new_doc = {**existing, **update_data, \"notify\": notify.upserted_id}\n", "\n", " result = await delivery_collection.insert_one(new_doc)\n", + " else:\n", + " doc = await posts_collection.update_one({'$or': fin}, {'$set': {\"status\": \"В каталоге\"}})\n", + " await delivery_collection.delete_one(\n", + " {\"post_id\": post_id, \"status\": \"Продано\"}\n", + " )\n", + "\n", " return {'ok': True}" ], "display_name": ".venv" diff --git a/main.py b/main.py index 697cc95..ac75bad 100644 --- a/main.py +++ b/main.py @@ -2443,6 +2443,12 @@ async def sale_painting( new_doc = {**existing, **update_data, "notify": notify.upserted_id} result = await delivery_collection.insert_one(new_doc) + else: + doc = await posts_collection.update_one({'$or': fin}, {'$set': {"status": "В каталоге"}}) + await delivery_collection.delete_one( + {"post_id": post_id, "status": "Продано"} + ) + return {'ok': True} @app.put("/api/post/{post_id}", response_model=dict)