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

Fix QCU answers in XpathParser

parent 33eb15de
Branches
No related tags found
No related merge requests found
......@@ -109,7 +109,7 @@ class XpathParser:
'//FunctionDeclaration[id/Identifier[@name="entrerDonnees"]]'
)
request_index_and_values = etree.XPath(
'*//VariableDeclarator[id//*[@name="nr"]]/init/Literal | *//AssignmentExpression[*//Identifier[@name="CODE_V"]]'
'*//VariableDeclarator[id//*[@name="nr"]]/init/Literal | *//AssignmentExpression//Identifier[starts-with(@name,"CODE_")]'
)
request_constructor_id = etree.XPath(
'*//NewExpression/callee/Identifier[@name="Cours" or starts-with(@name, "Exercice")]'
......@@ -153,8 +153,9 @@ class XpathParser:
# "index line"
index = int(value[0])
else:
# "true line"
insert_grow(correct_choices, index, True, fill_value=False)
# "correct" or "incorrect" line
correct = e.get("name") == "CODE_V"
insert_grow(correct_choices, index, correct, fill_value=False)
return correct_choices
def to_xml(self, obj, tag_name: Optional[str] = None):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment