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
6db57129
Commit
6db57129
authored
Oct 19, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Addressed bugs reported in review
parent
b63d2bfd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
12 deletions
+7
-12
problem_builder/mixins.py
+0
-1
problem_builder/slider.py
+6
-10
problem_builder/tests/integration/test_slider.py
+1
-1
No files found.
problem_builder/mixins.py
View file @
6db57129
...
...
@@ -126,7 +126,6 @@ class QuestionMixin(EnumerableChildMixin):
# Fields:
name
=
String
(
# This doesn't need to be a field but is kept for backwards compatibility with v1 student data
display_name
=
_
(
"Question ID (name)"
),
help
=
_
(
"The ID of this question (required). Should be unique within this mentoring component."
),
default
=
UNIQUE_ID
,
...
...
problem_builder/slider.py
View file @
6db57129
...
...
@@ -115,6 +115,7 @@ class SliderBlock(
Add some HTML to the author view that allows authors to see the ID of the block, so they
can refer to it in other blocks such as Plot blocks.
"""
context
[
'hide_header'
]
=
True
# Header is already shown in the Studio wrapper
fragment
=
self
.
student_view
(
context
)
fragment
.
add_content
(
loader
.
render_template
(
'templates/html/slider_edit_footer.html'
,
{
"url_name"
:
self
.
url_name
...
...
@@ -123,7 +124,7 @@ class SliderBlock(
def
get_last_result
(
self
):
""" Return the current/last result in the required format """
if
not
self
.
student_valu
e
:
if
self
.
student_value
is
Non
e
:
return
{}
return
{
'submission'
:
self
.
student_value
,
...
...
@@ -133,6 +134,10 @@ class SliderBlock(
'score'
:
1
,
}
def
get_results
(
self
,
_previous_result_unused
=
None
):
""" Alias for get_last_result() """
return
self
.
get_last_result
()
def
submit
(
self
,
value
):
log
.
debug
(
u'Received Slider submission: "
%
s"'
,
value
)
value
=
value
/
100.0
...
...
@@ -146,15 +151,6 @@ class SliderBlock(
log
.
debug
(
u'Slider submission result:
%
s'
,
result
)
return
result
def
get_author_edit_view_fragment
(
self
,
context
):
"""
The options for the 1-5 values of the Likert scale aren't child blocks but we want to
show them in the author edit view, for clarity.
"""
fragment
=
Fragment
(
u"<p>{}</p>"
.
format
(
self
.
question
))
self
.
render_children
(
context
,
fragment
,
can_reorder
=
True
,
can_add
=
False
)
return
fragment
def
validate_field_data
(
self
,
validation
,
data
):
"""
Validate this block's field data.
...
...
problem_builder/tests/integration/test_slider.py
View file @
6db57129
...
...
@@ -124,7 +124,7 @@ class SliderStepBlockTest(SliderBlockTestMixins, MentoringAssessmentBaseTest):
self
.
assertTrue
(
controls
.
submit
.
is_enabled
())
self
.
assert_hidden
(
controls
.
try_again
)
self
.
set_slider_value
(
99
)
self
.
set_slider_value
(
0
)
controls
.
submit
.
click
()
self
.
do_submit_wait
(
controls
,
last
=
False
)
self
.
wait_until_clickable
(
controls
.
next_question
)
...
...
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