Skip to content

Commit

Permalink
Fix small bug again
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Vignos committed Mar 13, 2024
1 parent 30bedc2 commit e6552cf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/category/controllers/populate_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ def generate_dining_hall_categories(self, json_event, event):
"Halal", "Kosher Station", "Flat Top Grill"]

def sort_menu(menu):
order = category_order.find(menu["category"].strip())
return order if order != -1 else len(category_order)
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"]}
Expand Down

0 comments on commit e6552cf

Please sign in to comment.