Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -406,6 +406,11 @@ def menu():
|
|
406 |
if 'Total_Ordered__c' not in item or item['Total_Ordered__c'] is None:
|
407 |
item['Total_Ordered__c'] = 0 # Default value
|
408 |
|
|
|
|
|
|
|
|
|
|
|
409 |
# Sort items by Total_Ordered__c in descending order and pick top 4 as best sellers
|
410 |
best_sellers = sorted(food_items, key=lambda x: x.get("Total_Ordered__c", 0), reverse=True)
|
411 |
print(f"Best sellers: {[item['Name'] for item in best_sellers]}") # Debugging
|
@@ -421,10 +426,6 @@ def menu():
|
|
421 |
if best_sellers:
|
422 |
ordered_menu["Best Sellers"] = best_sellers
|
423 |
|
424 |
-
# Define the order of sections, adding "Best Sellers" at the top
|
425 |
-
section_order = ["Best Sellers", "Starters","Biryanis","Curries","Breads","Apetizer", "Desserts", "Soft Drinks"]
|
426 |
-
ordered_menu = {section: [] for section in section_order}
|
427 |
-
|
428 |
# Filter and organize menu items based on category and section
|
429 |
for item in food_items:
|
430 |
section = item.get("Section__c", "Others") # Default to "Others" if missing
|
|
|
406 |
if 'Total_Ordered__c' not in item or item['Total_Ordered__c'] is None:
|
407 |
item['Total_Ordered__c'] = 0 # Default value
|
408 |
|
409 |
+
|
410 |
+
|
411 |
+
# Define the order of sections, adding "Best Sellers" at the top
|
412 |
+
section_order = ["Best Sellers", "Starters","Biryanis","Curries","Breads","Apetizer", "Desserts", "Soft Drinks"]
|
413 |
+
ordered_menu = {section: [] for section in section_order}
|
414 |
# Sort items by Total_Ordered__c in descending order and pick top 4 as best sellers
|
415 |
best_sellers = sorted(food_items, key=lambda x: x.get("Total_Ordered__c", 0), reverse=True)
|
416 |
print(f"Best sellers: {[item['Name'] for item in best_sellers]}") # Debugging
|
|
|
426 |
if best_sellers:
|
427 |
ordered_menu["Best Sellers"] = best_sellers
|
428 |
|
|
|
|
|
|
|
|
|
429 |
# Filter and organize menu items based on category and section
|
430 |
for item in food_items:
|
431 |
section = item.get("Section__c", "Others") # Default to "Others" if missing
|