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
No related branches found
No related tags found
No related merge requests found
...@@ -109,7 +109,7 @@ class XpathParser: ...@@ -109,7 +109,7 @@ class XpathParser:
'//FunctionDeclaration[id/Identifier[@name="entrerDonnees"]]' '//FunctionDeclaration[id/Identifier[@name="entrerDonnees"]]'
) )
request_index_and_values = etree.XPath( 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( request_constructor_id = etree.XPath(
'*//NewExpression/callee/Identifier[@name="Cours" or starts-with(@name, "Exercice")]' '*//NewExpression/callee/Identifier[@name="Cours" or starts-with(@name, "Exercice")]'
...@@ -153,8 +153,9 @@ class XpathParser: ...@@ -153,8 +153,9 @@ class XpathParser:
# "index line" # "index line"
index = int(value[0]) index = int(value[0])
else: else:
# "true line" # "correct" or "incorrect" line
insert_grow(correct_choices, index, True, fill_value=False) correct = e.get("name") == "CODE_V"
insert_grow(correct_choices, index, correct, fill_value=False)
return correct_choices return correct_choices
def to_xml(self, obj, tag_name: Optional[str] = None): 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