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

Extend QCU answers parser for QCM

parent c79a1abf
Branches
No related tags found
No related merge requests found
......@@ -52,8 +52,8 @@ class RegexParser:
activity_type, activity_var_name = self._parse_activity_constructor(body)
print(activity_type, end="", file=output)
if activity_type == "ExerciceQC_QCU":
print(" ", self._parse_qcu_answers(body), end="", file=output)
if activity_type.startswith("ExerciceQC"):
print(" ", self._parse_qc_answers(body), end="", file=output)
def _parse_activity_constructor(self, code: str) -> tuple[str, str]:
"""
......@@ -78,7 +78,7 @@ class RegexParser:
act_type += "_" + args.replace('"', "")
return act_type, var_name
def _parse_qcu_answers(self, code: str) -> list[bool]:
def _parse_qc_answers(self, code: str) -> list[bool]:
"""Parse the correct answers for a QCU activity, as a list of booleans"""
correct_choices = []
index = 0
......@@ -126,8 +126,8 @@ class XpathParser:
self.fun = self.request_function(xml)[0]
act_type = self._parse_activity_type()
print(act_type, end="", file=output)
if act_type == "ExerciceQC_QCU":
print(" ", self._parse_qcu_answers(), end="", file=output)
if act_type.startswith("ExerciceQC"):
print(" ", self._parse_qc_answers(), end="", file=output)
except Exception as e:
raise ParseError(e)
......@@ -142,7 +142,7 @@ class XpathParser:
case other:
return other
def _parse_qcu_answers(self) -> list[bool]:
def _parse_qc_answers(self) -> list[bool]:
"""Parse the correct answers for a QCU activity, as a list of booleans"""
indexes_and_values = self.request_index_and_values(self.fun)
correct_choices = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment