Commit 673a7533 by Matjaz Gregoric Committed by GitHub

Merge pull request #171 from open-craft/jill/MCKIN-6092

MCKIN-6092 Adds score_summary and review_tips to Step Builder student_view_user_state data
parents df221117 be33fa46
...@@ -124,6 +124,22 @@ contains these additional fields: ...@@ -124,6 +124,22 @@ contains these additional fields:
- `active_step`: (integer) The index of the step which is currently - `active_step`: (integer) The index of the step which is currently
active. Starts at zero. 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 ### Custom Handlers
......
...@@ -974,6 +974,7 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes ...@@ -974,6 +974,7 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
def build_user_state_data(self, context=None): def build_user_state_data(self, context=None):
user_state_data = super(MentoringWithExplicitStepsBlock, self).build_user_state_data() user_state_data = super(MentoringWithExplicitStepsBlock, self).build_user_state_data()
user_state_data['active_step'] = self.active_step_safe user_state_data['active_step'] = self.active_step_safe
user_state_data['score_summary'] = self.get_score_summary()
return user_state_data return user_state_data
@lazy @lazy
......
...@@ -206,7 +206,7 @@ class StudentViewUserStateMixin(object): ...@@ -206,7 +206,7 @@ class StudentViewUserStateMixin(object):
def build_user_state_data(self, context=None): def build_user_state_data(self, context=None):
""" """
Returns a dictionary of the student data of this XBlock, 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 = {} result = {}
...@@ -231,8 +231,7 @@ class StudentViewUserStateMixin(object): ...@@ -231,8 +231,7 @@ class StudentViewUserStateMixin(object):
@XBlock.handler @XBlock.handler
def student_view_user_state(self, context=None, suffix=''): def student_view_user_state(self, context=None, suffix=''):
""" """
Returns a JSON representation of the student data of this XBlock, Returns a JSON representation of the student data of this XBlock.
retrievable from the Course Block API.
""" """
result = self.build_user_state_data(context) result = self.build_user_state_data(context)
json_result = json.dumps(result, cls=DateTimeEncoder) json_result = json.dumps(result, cls=DateTimeEncoder)
......
...@@ -71,7 +71,7 @@ BLOCKS = [ ...@@ -71,7 +71,7 @@ BLOCKS = [
setup( setup(
name='xblock-problem-builder', name='xblock-problem-builder',
version='2.7.7', version='2.7.8',
description='XBlock - Problem Builder', description='XBlock - Problem Builder',
packages=find_packages(), packages=find_packages(),
install_requires=[ install_requires=[
......
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