f4lco / om-parser-stw-potsdam-v2

Connect canteens of the Studentenwerk Potsdam to OpenMensa
3 stars 7 forks source link

Fix Breaking Changes Due to Changes in the Mensa Website #27

Closed Tobias314 closed 1 month ago

Tobias314 commented 2 months ago

After some recent changes to the Mensa website, the parser seems to be broken (returning an internal server error). This PR provides a quick fix by proposing two changes:

  1. It seems like they changed the hyphen in the opening time string with an "Em Dash" (β€”) which breaks the whole parser. I modified the regex to match all characters between the opening and closing time to make it more robust.

  2. Also, it seems like None is returned for some price values which currently also breaks the whole parser. I added a check for this case which sets a price of "0.00". This is not perfect but at least it does not make the whole parser crash. If someone has time to further investigate and improve the parsing, this would be very welcome for a future PR I guess.

coveralls commented 2 months ago

Pull Request Test Coverage Report for Build c50bcb47-e432-4139-856b-329874004507

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
stw_potsdam/xml_types/meal_xml.py 1 2 50.0%
<!-- Total: 2 3 66.67% -->
Totals Coverage Status
Change from base Build a283eacd-5c18-429f-991c-cd25a791bcbd: -0.3%
Covered Lines: 425
Relevant Lines: 439

πŸ’› - Coveralls
f4lco commented 2 months ago

ο»ΏThank you Tobias for your patch, greatly appreciated! Unfortunately, because of vacation it may take more than a week until I can review the patch and do the ops work. Bear with me πŸ˜„

hotzenklotz commented 1 month ago

Any updates on this?

f4lco commented 1 month ago

@Tobias314 thank you so much for the time, effort, and patience πŸ™

The code change looks good to me - I'll merge immediately.

Hopefully I have time to look into hosting options this weekend - I think the former person hosting the parser is out of the picture, because he left university ages ago. We also transferred parser ownership to my humble self, so I do have the privileges to change the parser URL on the platform.

I'll keep you posted - if you do not hear back, please ping. At least I am near a machine again ;)

f4lco commented 1 month ago

@Tobias314 @hotzenklotz got it figured out. Not sure when OpenMensa will have refreshed all menus, but Griebnitzsee is already looking good again: https://openmensa.org/c/62 Thanks guys! πŸŽ‰