Unverified Commit 1603aaba by Matjaz Gregoric Committed by GitHub

Merge pull request #39 from zamanafzal/MCKIN-7018

Add attributes to student_view_data for both Poll and Survey
parents c7f34db7 04bcf089
...@@ -261,6 +261,9 @@ GET https://<lms_server_url>/api/courses/v1/blocks/?course_id=<course_id>&userna ...@@ -261,6 +261,9 @@ GET https://<lms_server_url>/api/courses/v1/blocks/?course_id=<course_id>&userna
Example poll return value: Example poll return value:
``` ```
"student_view_data": { "student_view_data": {
"feedback": "This is feedback message survey.",
"private_results": false,
"max_submissions": 1,
"question": "Did the explanation above make sense to you?", "question": "Did the explanation above make sense to you?",
"answers": [ "answers": [
[ [
...@@ -302,6 +305,10 @@ Example poll return value: ...@@ -302,6 +305,10 @@ Example poll return value:
Example survey return value: Example survey return value:
``` ```
"student_view_data": { "student_view_data": {
"feedback": "This is feedback message survey.",
"private_results": false,
"max_submissions": 1,
"block_name": "Poll2",
"answers": [ "answers": [
[ [
"Y", "Y",
......
...@@ -562,6 +562,9 @@ class PollBlock(PollBase, CSVExportMixin): ...@@ -562,6 +562,9 @@ class PollBlock(PollBase, CSVExportMixin):
return { return {
'question': self.question, 'question': self.question,
'answers': self.answers, 'answers': self.answers,
'max_submissions': self.max_submissions,
'private_results': self.private_results,
'feedback': self.feedback,
} }
@XBlock.handler @XBlock.handler
...@@ -846,6 +849,10 @@ class SurveyBlock(PollBase, CSVExportMixin): ...@@ -846,6 +849,10 @@ class SurveyBlock(PollBase, CSVExportMixin):
return { return {
'questions': self.questions, 'questions': self.questions,
'answers': self.answers, 'answers': self.answers,
'max_submissions': self.max_submissions,
'private_results': self.private_results,
'block_name': self.block_name,
'feedback': self.feedback,
} }
@XBlock.handler @XBlock.handler
......
...@@ -27,6 +27,9 @@ class TestPollBlock(unittest.TestCase): ...@@ -27,6 +27,9 @@ class TestPollBlock(unittest.TestCase):
['O', {'label': 'Other'}], ['O', {'label': 'Other'}],
], ],
'submissions_count': 5, 'submissions_count': 5,
'max_submissions': 1,
'private_results': False,
'feedback': 'My Feedback',
} }
self.poll_block = PollBlock( self.poll_block = PollBlock(
self.runtime, self.runtime,
...@@ -41,6 +44,9 @@ class TestPollBlock(unittest.TestCase): ...@@ -41,6 +44,9 @@ class TestPollBlock(unittest.TestCase):
expected_poll_data = { expected_poll_data = {
'question': self.poll_data['question'], 'question': self.poll_data['question'],
'answers': self.poll_data['answers'], 'answers': self.poll_data['answers'],
'max_submissions': self.poll_data['max_submissions'],
'private_results': self.poll_data['private_results'],
'feedback': self.poll_data['feedback'],
} }
student_view_data = self.poll_block.student_view_data() student_view_data = self.poll_block.student_view_data()
...@@ -86,7 +92,11 @@ class TestSurveyBlock(unittest.TestCase): ...@@ -86,7 +92,11 @@ class TestSurveyBlock(unittest.TestCase):
['N', 'No'], ['N', 'No'],
['M', 'Maybe'] ['M', 'Maybe']
], ],
'submissions_count': 5 'submissions_count': 5,
'max_submissions': 1,
'private_results': False,
'feedback': 'My Feedback',
'block_name': 'My Block Name',
} }
self.survey_block = SurveyBlock( self.survey_block = SurveyBlock(
self.runtime, self.runtime,
...@@ -101,6 +111,10 @@ class TestSurveyBlock(unittest.TestCase): ...@@ -101,6 +111,10 @@ class TestSurveyBlock(unittest.TestCase):
expected_survery_data = { expected_survery_data = {
'questions': self.survery_data['questions'], 'questions': self.survery_data['questions'],
'answers': self.survery_data['answers'], 'answers': self.survery_data['answers'],
'max_submissions': self.survery_data['max_submissions'],
'private_results': self.survery_data['private_results'],
'feedback': self.survery_data['feedback'],
'block_name': self.survery_data['block_name'],
} }
student_view_data = self.survey_block.student_view_data() student_view_data = self.survey_block.student_view_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