Commit 6db57129 by Braden MacDonald

Addressed bugs reported in review

parent b63d2bfd
...@@ -126,7 +126,6 @@ class QuestionMixin(EnumerableChildMixin): ...@@ -126,7 +126,6 @@ class QuestionMixin(EnumerableChildMixin):
# Fields: # Fields:
name = String( 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)"), display_name=_("Question ID (name)"),
help=_("The ID of this question (required). Should be unique within this mentoring component."), help=_("The ID of this question (required). Should be unique within this mentoring component."),
default=UNIQUE_ID, default=UNIQUE_ID,
......
...@@ -115,6 +115,7 @@ class SliderBlock( ...@@ -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 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. 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 = self.student_view(context)
fragment.add_content(loader.render_template('templates/html/slider_edit_footer.html', { fragment.add_content(loader.render_template('templates/html/slider_edit_footer.html', {
"url_name": self.url_name "url_name": self.url_name
...@@ -123,7 +124,7 @@ class SliderBlock( ...@@ -123,7 +124,7 @@ class SliderBlock(
def get_last_result(self): def get_last_result(self):
""" Return the current/last result in the required format """ """ Return the current/last result in the required format """
if not self.student_value: if self.student_value is None:
return {} return {}
return { return {
'submission': self.student_value, 'submission': self.student_value,
...@@ -133,6 +134,10 @@ class SliderBlock( ...@@ -133,6 +134,10 @@ class SliderBlock(
'score': 1, 'score': 1,
} }
def get_results(self, _previous_result_unused=None):
""" Alias for get_last_result() """
return self.get_last_result()
def submit(self, value): def submit(self, value):
log.debug(u'Received Slider submission: "%s"', value) log.debug(u'Received Slider submission: "%s"', value)
value = value / 100.0 value = value / 100.0
...@@ -146,15 +151,6 @@ class SliderBlock( ...@@ -146,15 +151,6 @@ class SliderBlock(
log.debug(u'Slider submission result: %s', result) log.debug(u'Slider submission result: %s', result)
return 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): def validate_field_data(self, validation, data):
""" """
Validate this block's field data. Validate this block's field data.
......
...@@ -124,7 +124,7 @@ class SliderStepBlockTest(SliderBlockTestMixins, MentoringAssessmentBaseTest): ...@@ -124,7 +124,7 @@ class SliderStepBlockTest(SliderBlockTestMixins, MentoringAssessmentBaseTest):
self.assertTrue(controls.submit.is_enabled()) self.assertTrue(controls.submit.is_enabled())
self.assert_hidden(controls.try_again) self.assert_hidden(controls.try_again)
self.set_slider_value(99) self.set_slider_value(0)
controls.submit.click() controls.submit.click()
self.do_submit_wait(controls, last=False) self.do_submit_wait(controls, last=False)
self.wait_until_clickable(controls.next_question) self.wait_until_clickable(controls.next_question)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment