From ab6ca3c158477a7d5c055fb0cb9346c2b97d19f6 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Wed, 19 Sep 2018 19:23:50 +0200 Subject: parsers: correction de l’index du premier élément à analyser Commencer au premier élément fait planter l’étape de déduction des éléments des cours si jamais un cours n’a ni nom, ni type. Signed-off-by: Alban Gruin --- management/parsers/ups2018.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'management/parsers') diff --git a/management/parsers/ups2018.py b/management/parsers/ups2018.py index 8d97517..15c629a 100644 --- a/management/parsers/ups2018.py +++ b/management/parsers/ups2018.py @@ -94,7 +94,7 @@ class Parser(AbstractParser): if data[0] == "Global Event": return - i = 1 + i = 0 while i < len(data) and not data[i].startswith( ("L1 ", "L2 ", "L3 ", "L3P ", "M1 ", "M2 ", "DEUST ", "MAG1 ", "1ERE ANNEE ", "2EME ANNEE ", "3EME ANNEE ", @@ -103,11 +103,11 @@ class Parser(AbstractParser): i += 1 groups = data[i] - if i - 1 > 0: + if i - 1 >= 0: course.name = ", ".join(set(data[i - 1].split(';'))) else: course.name = "Sans nom" - if i - 2 > 0: + if i - 2 >= 0: course.type = data[i - 2] if len(data) >= i + 2: rooms = data[i + 1] -- cgit v1.2.1