Commit d27e5702 by Jillian Vogel

MCKIN-6092 Adds score_summary (and review_tips)

to the data returned by Step Builder student_view_user_state
parent df221117
......@@ -124,6 +124,22 @@ contains these additional fields:
- `active_step`: (integer) The index of the step which is currently
active. Starts at zero.
- `score_summary`: (object) Contains the user's score information for their completed attempts.
If no attempts have been completed yet, then this object will be empty (`{}`).
If one or more attempts have been made, then this object will contain:
- `correct`: (array) list of questions that were answered correctly.
- `correct_answers`: (integer) Number of questions answered correctly.
- `incorrect`: (array) list of questions that were answered incorrectly.
- `incorrect_answers`: (integer) Number of questions answered incorrectly.
- `partial`: (array) list of questions that were answered partially correctly.
- `partially_correct_answers`: (integer) Number of questions answered partially correctly.
- `review_tips`: (array) List of review tips for each question answered incorrectly, where provided.
- `score`: (integer) Total points earned for the problems in the step builder, weighted for each step.
- `complete`: (boolean) True if all problems were answered correctly.
- `max_attempts_reached`: (boolean) True if the maximum number of attempts has been reached.
- `show_extended_review`: (boolean) True if extended feedback is configured, and the maximum
number of attempts has been reached.
### Custom Handlers
......
......@@ -974,6 +974,7 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
def build_user_state_data(self, context=None):
user_state_data = super(MentoringWithExplicitStepsBlock, self).build_user_state_data()
user_state_data['active_step'] = self.active_step_safe
user_state_data['score_summary'] = self.get_score_summary()
return user_state_data
@lazy
......
......@@ -206,7 +206,7 @@ class StudentViewUserStateMixin(object):
def build_user_state_data(self, context=None):
"""
Returns a dictionary of the student data of this XBlock,
retrievable from the Course Block API.
retrievable from the student_view_user_state XBlock handler.
"""
result = {}
......@@ -231,8 +231,7 @@ class StudentViewUserStateMixin(object):
@XBlock.handler
def student_view_user_state(self, context=None, suffix=''):
"""
Returns a JSON representation of the student data of this XBlock,
retrievable from the Course Block API.
Returns a JSON representation of the student data of this XBlock.
"""
result = self.build_user_state_data(context)
json_result = json.dumps(result, cls=DateTimeEncoder)
......
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