Commit 3a727dea by rabia23

EDUCATOR-1263 Fix Learner Training Assessment assess

parent b0a9f6d3
......@@ -92,7 +92,7 @@ def update_assessments_format(assessments):
{'text': example['answer']}
]
}
if isinstance(example, dict) and isinstance(example['answer'], list) and example['answer'] > 0 :
if isinstance(example, dict) and isinstance(example['answer'], list) and example['answer']:
example['answer'] = {
'parts': [
{'text': example['answer'][0]}
......
......@@ -55,6 +55,8 @@ class DataConversionTest(TestCase):
@ddt.data(
([{'answer': 'Ans'}], [{'answer': {'parts': [{'text': 'Ans'}]}}]),
([{'answer': ['Ans']}], [{'answer': {'parts': [{'text': 'Ans'}]}}]),
([{'answer': []}], [{'answer': []}]),
)
@ddt.unpack
def test_update_assessments_format(self, input, output):
......
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