Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

niederbayern_oberpfalz: improve invalid newline detection #108

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shad0w73
Copy link
Contributor

@shad0w73 shad0w73 commented Nov 8, 2019

Single invalid newlines weren't detected correctly. Improves fix of #107

Copy link
Collaborator

@klemens klemens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried reporting the problem upstream, i.e. at the Studentenwerk? Because this "csv file" is really broken.

@@ -61,6 +31,26 @@
from pyopenmensa.feed import LazyBuilder


# Only allow a newline after 8 separators
def replace_invalid_newlines(s):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be fixed much simpler with the following regex, which matches one or more newlines, if they are not followed by the date pattern and semicolon (negative lookahead): \n+(?!\d\d\.\d\d\.\d\d\d\d;)

For reference, the problematic part looks like:

12.11.2019;Di;Suppe;Grießnockerlsuppe (3,A,AA,C,I);V;0,70 / 0,90 / 1,40;0,70;0,90;1,40
12.11.2019;Di;HG1;// Selbstbedienung //

Schinkennudeln (2,3,8,A,AA);S;2,00 / 2,80 / 3,60;2,00;2,80;3,60
12.11.2019;Di;HG2;Vegane Kartoffelpizza (3,F);VG;2,80 / 3,40 / 4,40;2,80;3,40;4,40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants