From 47bb907d403394b1bb7c463c9c40472eca7af121 Mon Sep 17 00:00:00 2001 From: eliott <eliott.sammier@tetras-libre.fr> Date: Thu, 6 Jun 2024 11:30:34 +0200 Subject: [PATCH] Fix off-by-1 error for correct answers --- tetras_extraction/macao_12/script/extract_page.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tetras_extraction/macao_12/script/extract_page.py b/tetras_extraction/macao_12/script/extract_page.py index 733a6e39..ff371172 100644 --- a/tetras_extraction/macao_12/script/extract_page.py +++ b/tetras_extraction/macao_12/script/extract_page.py @@ -89,7 +89,7 @@ class RegexParser: m = re.match(r"var nr = (\d+);", line) if m is not None: # "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;": # "incorrect answer" line insert_grow(correct_choices, index, False, fill_value=False) @@ -153,7 +153,7 @@ class XpathParser: value = e.xpath("@value") if len(value) != 0: # "index line" - index = int(value[0]) + index = int(value[0]) - 1 # question indexes start at 1 else: # "correct" or "incorrect" line correct = e.get("name") == "CODE_V" -- GitLab