sorted products
This commit is contained in:
parent
8676bff0e0
commit
2ae79927c2
@ -232,7 +232,7 @@ async def on_message(message):
|
|||||||
products = product_query['data']
|
products = product_query['data']
|
||||||
sorted_products = sorted(products, key=lambda item: item['items'][0]['price']['regular'])
|
sorted_products = sorted(products, key=lambda item: item['items'][0]['price']['regular'])
|
||||||
response = f"Prices for `{product}` at `{store_name}` near `{zipcode}`:\n"
|
response = f"Prices for `{product}` at `{store_name}` near `{zipcode}`:\n"
|
||||||
for item in products:
|
for item in sorted_products:
|
||||||
product_name = item['description']
|
product_name = item['description']
|
||||||
price = item['items'][0]['price']['regular']
|
price = item['items'][0]['price']['regular']
|
||||||
response += f"- `${price}`: {product_name}: \n"
|
response += f"- `${price}`: {product_name}: \n"
|
||||||
|
Loading…
Reference in New Issue
Block a user