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
claim, q1, q2 = line.split(', ')
r1, r2 = None, None
for question_id, question in zip(question_ids, questions):
if question.name == q1:
r1 = response_function(question, question_id)
if question.name == q2:
r2 = response_function(question, question_id)
question_type = question.scope_ids.block_type
if question_type == 'pb-slider':
if question.url_name == q1:
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:
break
claims.append([claim, r1, r2])
......
......@@ -145,11 +145,17 @@ class SliderBlock(
self.student_value = value
if sub_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()
log.debug(u'Slider submission result: %s', 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):
"""
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