Skip to content

Commit

Permalink
Merge pull request #84 from cuappdev/reorder-menu
Browse files Browse the repository at this point in the history
Reorder menu categories
  • Loading branch information
tjvignos authored Mar 20, 2024
2 parents 05b1983 + e6552cf commit c5eb6de
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/category/controllers/populate_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@ def generate_dining_hall_categories(self, json_event, event):
category_items = {"category_name" : id, ... }
"""
category_items = {}
for json_menu in json_event["menu"]:

category_order = ["Chef's Table", "Chef's Table - Sides", "Grill", "Wok",
"Wok/Asian Station", "Iron Grill", "Mexican Station", "Global",
"Halal", "Kosher Station", "Flat Top Grill"]

def sort_menu(menu):
try:
return category_order.index(menu["category"].strip())
except ValueError:
return len(category_order)

for json_menu in sorted(json_event["menu"], key=sort_menu):
data = {"event": event, "category": json_menu["category"]}
category = CategorySerializer(data=data)

Expand Down

0 comments on commit c5eb6de

Please sign in to comment.