TUM-Dev/eat-api

Update Pricing of StudentenwerkParser

lukasdenk opened this issue · 4 comments

The Studentenwerk changed its pricing
Bildschirmfoto 2021-11-09 um 14 40 10
:

Before, the category "Studitopf, Suppe" also contained "vegan".

I will change it soon :)

I just found out, that there is another issue regarding the pricing, which I'm not sure, if it is included in your issue.

For example, the "Tagessuppe" is displayed with a pricing of 1 + 0.33 for students. However, since it is Studitopf(StudieTopf?), it can't have a base price. An example can be seen for "mensa-garching" on 10.11.2021.

COM8 commented

Yes. Saw this as well. Tagessuppe has a kind of broken price here :)
Perhaps we add a check if the name includes "suppe" and then set it to 0.33 without a base price?

I think, the issue can be found here:

eat-api/src/menu_parser.py

Lines 167 to 172 in 69e04ad

if dish[0] == "Studitopf" or dish[4] == "2": # Soup, Stew or Vegan
price_per_unit_type = StudentenwerkMenuParser.SelfServicePricePerUnitType.VEGAN_SOUP_STEW
else:
price_per_unit_type = StudentenwerkMenuParser.SelfServicePricePerUnitType.CLASSIC
if dish[4] == "0": # Non-Vegetarian

Once a dish is Studitopf, it shouldn't be considered for the non-vegetarian base price anymore.
However, since the Tagessuppe is dish[0] == "Studitopf" and dish[4] == "0" there is the non-vegetarian base price added.

Yes, sorry, that was my mistake. I didn't realize that base prices only count for classic menus. I will fix it.