Skip to content
Snippets Groups Projects
Commit 47bb907d authored by Eliott Sammier's avatar Eliott Sammier
Browse files

Fix off-by-1 error for correct answers

parent 035d29ec
Branches
Tags
No related merge requests found
...@@ -89,7 +89,7 @@ class RegexParser: ...@@ -89,7 +89,7 @@ class RegexParser:
m = re.match(r"var nr = (\d+);", line) m = re.match(r"var nr = (\d+);", line)
if m is not None: if m is not None:
# "index" line # "index" line
index = int(m.group(1)) index = int(m.group(1)) - 1 # question indexes start at 1
elif line == "exo.tabStylesR[nr] = CODE_F;": elif line == "exo.tabStylesR[nr] = CODE_F;":
# "incorrect answer" line # "incorrect answer" line
insert_grow(correct_choices, index, False, fill_value=False) insert_grow(correct_choices, index, False, fill_value=False)
...@@ -153,7 +153,7 @@ class XpathParser: ...@@ -153,7 +153,7 @@ class XpathParser:
value = e.xpath("@value") value = e.xpath("@value")
if len(value) != 0: if len(value) != 0:
# "index line" # "index line"
index = int(value[0]) index = int(value[0]) - 1 # question indexes start at 1
else: else:
# "correct" or "incorrect" line # "correct" or "incorrect" line
correct = e.get("name") == "CODE_V" correct = e.get("name") == "CODE_V"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment