fixed: create new priceslot

This commit is contained in:
thanawat saiyota 2026-06-17 15:42:21 +07:00
parent aef5cdd348
commit 79a5630c7e

12
main.py
View file

@ -527,7 +527,7 @@ def redis_message_handler():
if (option and option == "PriceSlot"):
handle_get_price_slot(country, user_id)
else:
if not (content):
if not (content) and option != "All":
raise Exception (f"[{SERVICE_NAME}] Missing required parameters | Channel: {channel}")
handle_get_price(country, user_id, content)
@ -1749,8 +1749,16 @@ def handle_get_price(country: str, user_id: str, content: list):
header = [c.get("fields", {}).get("label", "") for c in sorted_cols]
result = []
content_items = content
if not content_items:
content_items = []
for row_obj in price_data:
row = row_obj["fields"]
if len(row) > 0 and str(row[0]).strip():
content_items.append({"product_code": str(row[0]).strip()})
for item in content:
for item in content_items:
product_code = item.get("product_code", "").strip()
if not product_code:
continue