Open capstan1 opened 6 years ago
Slightly more detailed explanation of the issue:
The dish in the category "Fleischgericht" is "Riesen-Currywurst mit Currysoße". On the canteen's website, when you click it to expand its description, the side dishes are listed in the element as a list, alongside the table containing the additives.
Bratkartoffeln
Weißkohlsalat in Essig-Öl-Marinade
Zusatzstoffe: 2, 3
Allergene: 13, 19, 21, 22
This gets parsed into the following list of notes on the OpenMensa canteen site:
Rind
Senf
Sellerie
Milch/ Milchzucker
Weißkohlsalat in Essig-Öl-Marinade
Schwein
glutenhaltiges Getreide
mit Antioxidationsmitteln
mit Konservierungsstoff
Bratkartoffeln
Think I have come closer: Part of Source code of canteen's website :
> <group type="1" location="162" productiondate="2018-04-18" sort="6">
> --
> | <name>Fleischgericht</name>
> | <internalname>Essen C</internalname>
> | <prices size="3">
> | <price consumerID="0">2.45</price>
> | <price consumerID="1">4.20</price>
> | <price consumerID="2">5.90</price>
> | </prices>
> | <taggings>
> | <tagging taggingID="2" type="additives">mit Konservierungsstoff</tagging>
> | <tagging taggingID="3" type="additives">mit Antioxidationsmitteln</tagging>
> | <tagging taggingID="13" type="allergens">glutenhaltiges Getreide</tagging>
> | <tagging taggingID="19" type="allergens">Milch/ Milchzucker</tagging>
> | <tagging taggingID="21" type="allergens">Sellerie</tagging>
> | <tagging taggingID="22" type="allergens">Senf</tagging>
> | <tagging taggingID="51" type="ingredients">Schwein</tagging>
> | <tagging taggingID="52" type="ingredients">Rind</tagging>
> | </taggings>
> | <components size="3">
> | <component elementid="0" sort="1">
> | <name1>Riesen-Currywurst mit Currysoße</name1>
> | </component>
> | <component elementid="1" sort="2">
> | <name1>Bratkartoffeln</name1>
> | </component>
> | <component elementid="2" sort="3">
> | <name1>Weißkohlsalat in Essig-Öl-Marinade</name1>
> | </component>
> | </components>
> | </group>
>
So side-dishes are components with an elemntid >0. Additives are taggings.
I found this part in the Uni Leipzig parser:
if '1' == group['type']:
meal consisting of multiple parts, use first component as name
if len(components) < 1: print("meal without component: {}".format(group)) continue notes = components[1:] + tags canteen.addMeal(date, category, components[0], notes, prices) elif '2' == group['type']: # multiple components to choose from for component in components: canteen.addMeal(date, category, component, tags, prices) else: print('unknown meal type: {}'.format(group['type']))
So the third part (elif '2' == group['type']:) should be handeling this. I don't understand whats going wrong. Maybe its the use of "component" whereas its "components" in other parts? But this doesn't explain why its still there.
This is sort of a deliberate choice, as you usually cannot separately buy the side dishes, so splitting them up into separate meals doesn't seem right. And the openmensa model does not support a meal consisting of several parts.
Therefore I see two possible short-term solutions: Either include the side dishes into the title of the menu, like "Riesen-Currywurst mit Currysoße, Bratkartoffeln und Weißkohlsalat in Essig-Öl-Marinade" or at least order them as the first two notes (maybe with some prefix/suffix?).
@klemens I'm with you: they should not go in different meals (although you actually can buy ome of the side dishes seperately here :P ) Problem is, sometimes it's like you mentioned ("Riesen-Currywurst mit Currysoße, Bratkartoffeln und Weißkohlsalat in Essig-Öl-Marinade") but sometimes its also choosing. So you could have "Bratkartoffeln" or "Salzkartoffeln" or "Reis" to choose from. No way to differentiate it.
So Maybe it could be: "Riesen-Currywurst mit Currysauce, Beilagen: Bratkartoffeln, Weißkohlsalat in Essig-Öl-Marinade,..."
Your second suggestion (displaying them first) would also work, but maybe it would be hard to seperate them in apps later? What do you mean by prefix? Would it be possible to display it like this?
Riesen-Currywurst mit Currysoße Beilagen: Bratkartoffeln, Weißkohlsalat in Essig-Öl-Marinade Inhaltsstoffe und Allergene: Rind, Schwein, ...
although you actually can buy ome of the side dishes seperately here
I know (I'm currently on my way to one of the Leipzig canteens :wink:), but the API unfortunately doesn't include the price.
[...] but sometimes its also choosing
Do you have an example? I have never seen that in the API.
[...] but maybe it would be hard to seperate them in apps later?
For this we would need to update the model and the app anyway, so changing the parser again when this is possible doesn't seem like a problem.
With prefix I meant:
Beilage: Bratkartoffeln, Beilage: Weißkohlsalat in Essig-Öl-Marinade, Ring, Schwein
We could also prefix all other notes, but I think that would be excessive.
[...] but sometimes its also choosing
Do you have an example? I have never seen that in the API.
Thailändisches Zitronengrashähnchen mit Kokos-Currysoße Asiatisches Gemüse Basmatireis Pommes frites
You can choose from Basmatireis and Pommes frites.
With prefix I meant:
Beilage: Bratkartoffeln, Beilage: Weißkohlsalat in Essig-Öl-Marinade, Ring, Schwein
If theres no problem in ordering it I would prefer to set a prefix before each section:
Riesen-Currywurst mit Currysoße
Beilagen: Bratkartoffeln, Weißkohlsalat in Essig-Öl-Marinade, Inhaltsstoffe und Allergene: Rind, Schwein, ...
I looked at it again and the the side dished are already correctly ordered in the generated xml, but openmensa doesn't store them in order, so a single prefix approach wouldn't work and prefixing everything will probably also look strange if they are not ordered.
So adding everything to the title seems like the best (or least bad) solution for now.
Yeah, probably thats the best way to go!
At uni Leipzig side dishes (french fries, rice etc) are listed as the last item(s) of the list of additives and allergens. (see: https://openmensa.org/c/67 ) I guess it would be possible to get them seperated, as the officual homepage has it seperated ( https://www.studentenwerk-leipzig.de/mensen-cafeterien/speiseplan?location=106 )
There would be needed another category of "side dishes" under each dish (or it could be merged with the title "dish-name mit side-dish1, side dish2...",
Sadly I don't have the knowledge myself for such improvements.