Revert "starpost: restrict cargo to first order"

This reverts commit ecd6d55523.
This commit is contained in:
TakuyaYagam1 committed 2026-10-25 13:55:17 +03:00
1 parent 206f16cf05
commit 0a4439444e
2 files changed
+15 -52

No files matched your search

+1 -16
View File
@@ -579,22 +579,7 @@ def checkout():
@auth("buyer")
def buyer_orders():
with db() as conn, conn.cursor() as cur:
cur.execute(
"""
SELECT o.id,o.status,o.warehouse_status,o.warehouse_updated_at,
o.tracking_code,o.price,o.created_at,o.delivered_at,p.name,
CASE
WHEN o.status='delivered'
AND o.id=(SELECT min(first_order.id) FROM orders first_order
WHERE first_order.product_id=o.product_id)
THEN p.cargo
ELSE NULL
END cargo
FROM orders o JOIN products p ON p.id=o.product_id
WHERE o.buyer_id=%s ORDER BY o.id DESC
""",
(session["user_id"],),
)
cur.execute("SELECT o.id,o.status,o.warehouse_status,o.warehouse_updated_at,o.tracking_code,o.price,o.created_at,o.delivered_at,p.name,CASE WHEN o.status='delivered' THEN p.cargo ELSE NULL END cargo FROM orders o JOIN products p ON p.id=o.product_id WHERE o.buyer_id=%s ORDER BY o.id DESC", (session["user_id"],))
return jsonify(cur.fetchall())