Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
OpenEdx
problem-builder
Commits
f03bf074
Commit
f03bf074
authored
Mar 09, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow tips to process multiple submissions for accepting/displaying
parent
5f8d9c03
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
17 deletions
+25
-17
mentoring/mcq.py
+2
-12
mentoring/questionnaire.py
+9
-0
mentoring/tip.py
+14
-5
No files found.
mentoring/mcq.py
View file @
f03bf074
...
@@ -56,8 +56,8 @@ class MCQBlock(QuestionnaireAbstractBlock):
...
@@ -56,8 +56,8 @@ class MCQBlock(QuestionnaireAbstractBlock):
completed
=
True
completed
=
True
tips_fragments
=
[]
tips_fragments
=
[]
for
tip
in
self
.
get_tips
():
for
tip
in
self
.
get_tips
():
completed
=
completed
and
tip
.
is_completed
(
submission
)
completed
=
completed
and
tip
.
is_completed
(
[
submission
]
)
if
tip
.
is_tip_displayed
(
submission
):
if
tip
.
is_tip_displayed
(
[
submission
]
):
tips_fragments
.
append
(
tip
.
render
(
submission
))
tips_fragments
.
append
(
tip
.
render
(
submission
))
formatted_tips
=
render_template
(
'templates/html/tip_group.html'
,
{
formatted_tips
=
render_template
(
'templates/html/tip_group.html'
,
{
...
@@ -75,13 +75,3 @@ class MCQBlock(QuestionnaireAbstractBlock):
...
@@ -75,13 +75,3 @@ class MCQBlock(QuestionnaireAbstractBlock):
}
}
log
.
debug
(
u'MCQ submission result:
%
s'
,
result
)
log
.
debug
(
u'MCQ submission result:
%
s'
,
result
)
return
result
return
result
def
get_submission_display
(
self
,
submission
):
"""
Get the human-readable version of a submission value
"""
for
choice
in
self
.
custom_choices
:
if
choice
.
value
==
submission
:
return
choice
.
content
return
submission
mentoring/questionnaire.py
View file @
f03bf074
...
@@ -101,3 +101,12 @@ class QuestionnaireAbstractBlock(LightChild):
...
@@ -101,3 +101,12 @@ class QuestionnaireAbstractBlock(LightChild):
if
isinstance
(
child
,
TipBlock
):
if
isinstance
(
child
,
TipBlock
):
tips
.
append
(
child
)
tips
.
append
(
child
)
return
tips
return
tips
def
get_submission_display
(
self
,
submission
):
"""
Get the human-readable version of a submission value
"""
for
choice
in
self
.
custom_choices
:
if
choice
.
value
==
submission
:
return
choice
.
content
return
submission
mentoring/tip.py
View file @
f03bf074
...
@@ -70,11 +70,20 @@ class TipBlock(LightChild):
...
@@ -70,11 +70,20 @@ class TipBlock(LightChild):
}))
}))
return
self
.
xblock_container
.
fragment_text_rewriting
(
fragment
)
return
self
.
xblock_container
.
fragment_text_rewriting
(
fragment
)
def
is_completed
(
self
,
submission
):
def
is_completed
(
self
,
submissions
):
return
submission
and
submission
not
in
self
.
reject_with_defaults
if
not
submissions
:
return
False
def
is_tip_displayed
(
self
,
submission
):
return
submission
in
self
.
display_with_defaults
for
submission
in
submissions
:
if
submission
in
self
.
reject_with_defaults
:
return
False
return
True
def
is_tip_displayed
(
self
,
submissions
):
for
submission
in
submissions
:
if
submission
in
self
.
display_with_defaults
:
return
True
return
False
@property
@property
def
display_with_defaults
(
self
):
def
display_with_defaults
(
self
):
...
...
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