1
0
mirror of synced 2024-11-24 05:30:11 +01:00

parsers.py: Add support for multi-value SCOREINIT/SCOREDIFF

Fixes #34.
This commit is contained in:
Viv 2023-07-15 12:02:50 -04:00
parent fbe2fe21cc
commit b5abb8d4b9

View File

@ -56,10 +56,11 @@ def getCourseData(lines):
raise ValueError() raise ValueError()
elif nameUpper == 'LEVEL': elif nameUpper == 'LEVEL':
parsedTJA.courses[currentCourse].level = int(value) if value else 0 parsedTJA.courses[currentCourse].level = int(value) if value else 0
# NB: If there are multiple SCOREINIT/SCOREDIFF values, use the last one (shinuti)
elif nameUpper == 'SCOREINIT': elif nameUpper == 'SCOREINIT':
parsedTJA.courses[currentCourse].scoreInit = int(value) if value else 0 parsedTJA.courses[currentCourse].scoreInit = int(value.split(",")[-1]) if value else 0
elif nameUpper == 'SCOREDIFF': elif nameUpper == 'SCOREDIFF':
parsedTJA.courses[currentCourse].scoreDiff = int(value) if value else 0 parsedTJA.courses[currentCourse].scoreDiff = int(value.split(",")[-1]) if value else 0
elif nameUpper == 'BALLOON': elif nameUpper == 'BALLOON':
if value: if value:
balloons = [int(v) for v in value.split(",") if v] balloons = [int(v) for v in value.split(",") if v]