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
9f9617b4
Commit
9f9617b4
authored
Nov 23, 2013
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always display the tip when a rejected choice is selected
parent
cb11ea0e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
mentoring/quizz.py
+15
-6
No files found.
mentoring/quizz.py
View file @
9f9617b4
...
...
@@ -3,6 +3,7 @@
# Imports ###########################################################
import
copy
import
logging
from
xblock.core
import
XBlock
...
...
@@ -86,7 +87,7 @@ class QuizzBlock(XBlock):
return
fragment
def
submit
(
self
,
submission
):
log
.
info
(
u'Received quizz submission:
%
s
'
,
submission
)
log
.
debug
(
u'Received quizz submission: "
%
s"
'
,
submission
)
completed
=
self
.
is_completed
(
submission
)
show_tip
=
self
.
is_tip_shown
(
submission
)
...
...
@@ -99,11 +100,16 @@ class QuizzBlock(XBlock):
else
:
formatted_tip
=
''
re
turn
{
re
sult
=
{
'submission'
:
submission
,
'completed'
:
completed
,
'tip'
:
formatted_tip
,
}
log
.
debug
(
u'display_with_defaults:
%
s, reject_with_defaults:
%
s'
,
self
.
display_with_defaults
,
self
.
reject_with_defaults
)
log
.
debug
(
u'Quizz submission result:
%
s'
,
result
)
return
result
def
is_completed
(
self
,
submission
):
return
submission
and
submission
not
in
self
.
reject_with_defaults
...
...
@@ -117,13 +123,16 @@ class QuizzBlock(XBlock):
if
self
.
type
==
'yes-no-unsure'
:
return
[
'no'
,
'unsure'
]
elif
self
.
type
==
'rating'
:
return
[
1
,
2
,
3
]
return
[
'1'
,
'2'
,
'3'
]
else
:
return
self
.
reject
@property
def
display_with_defaults
(
self
):
if
self
.
display
is
None
:
return
self
.
reject_with_defaults
display
=
copy
.
copy
(
self
.
display
)
if
display
is
None
:
display
=
self
.
reject_with_defaults
else
:
return
self
.
display
display
+=
[
choice
for
choice
in
self
.
reject_with_defaults
if
choice
not
in
display
]
return
display
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