Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenQuizz
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
10
Issues
10
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Weber Rodolphe
OpenQuizz
Commits
b05f534b
Commit
b05f534b
authored
Sep 24, 2021
by
Jérémie Passerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cycle complet xml calculee simple
parent
ef5d7e48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
3 deletions
+44
-3
contenu_dao.py
modele/contenu_dao.py
+44
-3
No files found.
modele/contenu_dao.py
View file @
b05f534b
...
...
@@ -868,6 +868,9 @@ class ContenuDao:
liste_note
=
[]
liste_feedback
=
[]
liste_tolerance
=
[]
liste_tolerance_type
=
[]
liste_reponse_format
=
[]
liste_reponse_taille
=
[]
for
answer
in
root
.
iter
(
'answer'
):
liste_note
.
append
(
answer
.
attrib
[
"fraction"
])
for
question
in
answer
.
iter
(
'text'
):
...
...
@@ -880,11 +883,25 @@ class ContenuDao:
# print ("tolerance : ", tolerance.text)
if
tolerance
.
text
is
not
None
:
liste_tolerance
.
append
(
tolerance
.
text
)
if
elements_question
[
"type_question"
]
==
"calculatedsimple"
:
for
type
in
answer
.
iter
(
'tolerancetype'
):
if
type
.
text
is
not
None
:
liste_tolerance_type
.
append
(
type
.
text
)
for
format
in
answer
.
iter
(
'correctanswerformat'
):
if
format
.
text
is
not
None
:
liste_reponse_format
.
append
(
format
.
text
)
for
length
in
answer
.
iter
(
'correctanswerlength'
):
if
length
.
text
is
not
None
:
liste_reponse_taille
.
append
(
length
.
text
)
elements_question
[
"liste_reponse"
]
=
liste_reponse
elements_question
[
"liste_note"
]
=
liste_note
elements_question
[
"liste_feedback"
]
=
liste_feedback
elements_question
[
"liste_tolerance"
]
=
liste_tolerance
if
elements_question
[
"type_question"
]
==
"calculatedsimple"
:
elements_question
[
"liste_tolerance_type"
]
=
liste_tolerance_type
elements_question
[
"liste_reponse_format"
]
=
liste_reponse_format
elements_question
[
"liste_reponse_taille"
]
=
liste_reponse_taille
# elif elements_question["type_question"] == 'calculatedsimple':
# print("calculatedsimple")
...
...
@@ -1076,13 +1093,20 @@ class ContenuDao:
# on ajoute les éventuelles nouvelles unités
if
i
<
len
(
elements_contenu
[
"liste_unite_nom"
]):
for
question
in
root
.
iter
(
'question'
):
for
unit
in
question
.
iter
(
'units'
)
:
print
(
"1. : "
,
str
(
ET
.
tostring
(
unit
))
)
new_unit
=
SubElement
(
unit
,
"unit"
)
if
sum
(
1
for
_
in
question
.
iter
(
'units'
))
==
0
:
creer_units
=
SubElement
(
question
,
"units"
)
new_unit
=
SubElement
(
creer_units
,
"unit"
)
multiplier
=
SubElement
(
new_unit
,
"multiplier"
)
multiplier
.
text
=
elements_contenu
[
"liste_unite_coef"
][
i
]
unit_name
=
SubElement
(
new_unit
,
"unit_name"
)
unit_name
.
text
=
elements_contenu
[
"liste_unite_nom"
][
i
]
else
:
for
unit
in
question
.
iter
(
'units'
):
new_unit
=
SubElement
(
unit
,
"unit"
)
multiplier
=
SubElement
(
new_unit
,
"multiplier"
)
multiplier
.
text
=
elements_contenu
[
"liste_unite_coef"
][
i
]
unit_name
=
SubElement
(
new_unit
,
"unit_name"
)
unit_name
.
text
=
elements_contenu
[
"liste_unite_nom"
][
i
]
# print("Je le ai ", len(elements_contenu["liste_note"]), " notes, ", len(elements_contenu["liste_feedback"]), " feedbacks, ",
# len(elements_contenu["liste_reponse"]), " reponses et ", len(elements_contenu["liste_tolerance"]), "tolerances")
...
...
@@ -1099,6 +1123,16 @@ class ContenuDao:
for
tolerance
in
answer
.
iter
(
'tolerance'
):
if
tolerance
.
text
is
not
None
:
tolerance
.
text
=
elements_contenu
[
"liste_tolerance"
][
i
]
if
elements_contenu
[
"type_question"
]
==
"calculatedsimple"
:
for
type
in
answer
.
iter
(
'tolerancetype'
):
if
type
.
text
is
not
None
:
type
.
text
=
elements_contenu
[
"liste_tolerance_type"
][
i
]
for
format
in
answer
.
iter
(
'correctanswerformat'
):
if
format
.
text
is
not
None
:
format
.
text
=
elements_contenu
[
"liste_reponse_format"
][
i
]
for
length
in
answer
.
iter
(
'correctanswerlength'
):
if
length
.
text
is
not
None
:
length
.
text
=
elements_contenu
[
"liste_reponse_taille"
][
i
]
i
+=
1
# on ajoute les éventuelles nouvelles réponses
...
...
@@ -1116,6 +1150,13 @@ class ContenuDao:
text_feedback
.
text
=
elements_contenu
[
"liste_feedback"
][
i
]
tolerance
=
SubElement
(
new_answer
,
"tolerance"
)
tolerance
.
text
=
elements_contenu
[
"liste_tolerance"
][
i
]
if
elements_contenu
[
"type_question"
]
==
"calculatedsimple"
:
tolerance_type
=
SubElement
(
new_answer
,
"tolerancetype"
)
tolerance_type
.
text
=
elements_contenu
[
"liste_tolerance_type"
][
i
]
correct_answer_format
=
SubElement
(
new_answer
,
"correctanswerformat"
)
correct_answer_format
.
text
=
elements_contenu
[
"liste_reponse_format"
][
i
]
correct_answer_length
=
SubElement
(
new_answer
,
"correctanswerlength"
)
correct_answer_length
.
text
=
elements_contenu
[
"liste_reponse_taille"
][
i
]
i
+=
1
# on maj le fichier du contenu
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment