TUM-Dev/eat-api

Improve price predictions for Self-Service dishes

COM8 opened this issue · 1 comments

COM8 commented

Currently, we are determining the prices for "Self-Service" dishes based on their ingredients.

eat-api/src/menu_parser.py

Lines 123 to 138 in c18419b

def __getPrice(location: str, dish: Tuple[str, str, str, str, str]) -> Prices:
if "Self-Service" in dish[0] or location == "mensa-garching":
if dish[4] == "0": # Meat
prices: Prices = StudentenwerkMenuParser.prices_self_service_classic
# Add a base price to the dish
if "Fi" in dish[2]: # Fish
prices.setBasePrice(StudentenwerkMenuParser.prices_self_service_base[2])
else: # Sausage and meat. TODO: Find a way to distinguish between sausage and meat
prices.setBasePrice(StudentenwerkMenuParser.prices_self_service_base[1])
return prices
if dish[4] == "1": # Vegetarian
return StudentenwerkMenuParser.prices_self_service_classic
if dish[4] == "2": # Vegan
return StudentenwerkMenuParser.prices_self_service_vegan
else:
pass

This is not that reliable, and we need a better way to do this. Perhaps there might be more information we can extract from the website, so we get better predictions.

Price list:
https://www.studentenwerk-muenchen.de/mensa/mensa-preise/

Menu:
https://www.studentenwerk-muenchen.de/mensa/speiseplan/speiseplan_422_-de.html#heute

I am working on it.
One problem right now is that dish[0] contains the dish type. Therefore, only the prices for mensa-garching are currently parsed by that if clause.