Skip to content

Commit

Permalink
Merge pull request #171 from open-craft/jill/MCKIN-6092
Browse files Browse the repository at this point in the history
MCKIN-6092 Adds score_summary and review_tips to Step Builder student_view_user_state data
  • Loading branch information
mtyaka committed Oct 5, 2017
2 parents df22111 + be33fa4 commit 673a753
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
16 changes: 16 additions & 0 deletions doc/Native APIs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions problem_builder/mentoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions problem_builder/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def transforms(self):
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 = {}
Expand All @@ -231,8 +231,7 @@ def build_user_state_data(self, context=None):
@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)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def package_data(pkg, root_list):

setup(
name='xblock-problem-builder',
version='2.7.7',
version='2.7.8',
description='XBlock - Problem Builder',
packages=find_packages(),
install_requires=[
Expand Down

0 comments on commit 673a753

Please sign in to comment.