Commit 0ff61a29 by Tim Krones

Fix: Make sure plot can retrieve data from scale questions.

parent f236debd
...@@ -175,10 +175,17 @@ class PlotBlock(StudioEditableXBlockMixin, StudioContainerWithNestedXBlocksMixin ...@@ -175,10 +175,17 @@ class PlotBlock(StudioEditableXBlockMixin, StudioContainerWithNestedXBlocksMixin
claim, q1, q2 = line.split(', ') claim, q1, q2 = line.split(', ')
r1, r2 = None, None r1, r2 = None, None
for question_id, question in zip(question_ids, questions): for question_id, question in zip(question_ids, questions):
if question.name == q1: question_type = question.scope_ids.block_type
r1 = response_function(question, question_id) if question_type == 'pb-slider':
if question.name == q2: if question.url_name == q1:
r2 = response_function(question, question_id) r1 = response_function(question, question_id)
if question.url_name == q2:
r2 = response_function(question, question_id)
else:
if question.name == q1:
r1 = response_function(question, question_id)
if question.name == q2:
r2 = response_function(question, question_id)
if r1 is not None and r2 is not None: if r1 is not None and r2 is not None:
break break
claims.append([claim, r1, r2]) claims.append([claim, r1, r2])
......
...@@ -145,11 +145,17 @@ class SliderBlock( ...@@ -145,11 +145,17 @@ class SliderBlock(
self.student_value = value self.student_value = value
if sub_api: if sub_api:
# Also send to the submissions API: # Also send to the submissions API:
sub_api.create_submission(self.student_item_key, {'value': value}) sub_api.create_submission(self.student_item_key, value)
result = self.get_last_result() result = self.get_last_result()
log.debug(u'Slider submission result: %s', result) log.debug(u'Slider submission result: %s', result)
return result return result
def get_submission_display(self, submission):
"""
Get the human-readable version of a submission value
"""
return submission * 100
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.
......
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