Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCKIN-6092 Adds score_summary and review_tips to Step Builder student_view_user_state data #171

Merged
merged 2 commits into from
Oct 5, 2017

Conversation

pomegranited
Copy link
Member

@pomegranited pomegranited commented Oct 5, 2017

Includes the data used to populate Review Step HTML pages in the data returned by the Step Builder's XBlock handler student_view_user_state.

This data is stored in the score_summary object, and includes any review_tips recommended for display for incorrect question responses.

JIRA tickets: MCKIN-6092, OC-3172

Sandbox URL: sandbox is being provisioned.

Testing instructions:

  1. In Studio, import this test course: course.MCKIN-6092.tar.gz
    Note the course ID for the following steps.
  2. Navigate to the Step Builder unit in the LMS. Don't attempt any problems yet.
  3. In the JS console, run the following code:
    lms_url = "http://localhost:8000"; // your LMS URL here
    course_number = "ORG+COURSE+RUN"; // your course run ID here
    course_id = "course-v1:" + course_number;
    block_id = "block-v1:" + course_number + "+type@step-builder+block@413b19be288b4323aa4136827d18b70c";
    $.getJSON({url: lms_url + "/courses/" + course_id + "/xblock/" + block_id + "/handler/student_view_user_state", success: function(data) { console.log(data); } })
  4. Verify that the returned score_summary is empty. It will remain empty until one or more attempts are complete.
  5. Answer all the problems, and proceed to the Review Step.
  6. Re-run the getJSON() call from above.
    Note that the score_summary component now reflects the content of the review step, including the review_tips array, which contains an entry for each incorrect answer.
Example response from `student_view_user_state`
{  
   "num_attempts":2,
   "active_step":-1,
   "score_summary":{  
      "partial":[  
         {  
            "step":2,
            "number":2,
            "id":"e309fed3cd5ea3cae333625ebb1a8c44d42b5535",
            "details":{  
               "status":"partial",
               "weight":1,
               "choices":[  
                  {  
                     "content":"Straw",
                     "completed":false,
                     "selected":true,
                     "value":"7458406"
                  },
                  {  
                     "content":"Bricks",
                     "completed":true,
                     "selected":true,
                     "value":"3f512ac"
                  },
                  {  
                     "content":"Sticks",
                     "completed":true,
                     "selected":false,
                     "value":"90057e8"
                  },
                  {  
                     "content":"Pigs can't build houses.",
                     "completed":true,
                     "selected":true,
                     "value":"1bb75fd"
                  }
               ],
               "score":0.75,
               "message":"",
               "submissions":[  
                  "7458406",
                  "3f512ac",
                  "1bb75fd"
               ]
            }
         }
      ],
      "complete":false,
      "partially_correct_answers":1,
      "show_extended_review":false,
      "correct_answers":1,
      "incorrect_answers":0,
      "review_tips":[  
         "<p>Review&nbsp;the story of the <a href=\"https://en.wikipedia.org/wiki/The_Three_Little_Pigs\" target=\"[object Object]\">Three Little Pigs</a>.</p>"
      ],
      "incorrect":[  

      ],
      "max_attempts_reached":false,
      "score":88,
      "correct":[  
         {  
            "step":1,
            "number":1,
            "id":"ec4902c164cad303db5f470a85f1f2fb10627e7a",
            "details":{  
               "status":"correct",
               "submission":"bb87b70",
               "weight":1,
               "score":1,
               "message":""
            }
         }
      ]
   },
   "components":{  
      "block-v1:OpenCraft+MCKIN+6092+type@sb-step+block@d21efef7a1d849a48ebc73ba203cf3a0":{  
         "student_results":[  
            [  
               "ec4902c164cad303db5f470a85f1f2fb10627e7a",
               {  
                  "status":"correct",
                  "submission":"bb87b70",
                  "weight":1,
                  "score":1,
                  "message":""
               }
            ]
         ],
         "components":{  
            "block-v1:OpenCraft+MCKIN+6092+type@pb-mcq+block@9b3141ca2e0f436da8c3fa7047eb1e96":{  
               "student_choice":"bb87b70",
               "components":{  
                  "block-v1:OpenCraft+MCKIN+6092+type@pb-choice+block@47c3af6495804609807b09541a47a502":{  

                  },
                  "block-v1:OpenCraft+MCKIN+6092+type@pb-choice+block@ee04db45f2654f9f802deefcc3537c03":{  

                  },
                  "block-v1:OpenCraft+MCKIN+6092+type@pb-choice+block@07d2729e75c34c7e815b58375be24a1c":{  

                  }
               }
            }
         }
      },
      "block-v1:OpenCraft+MCKIN+6092+type@sb-step+block@81d83c39ea754bdea8dd4d5222b3a58a":{  
         "student_results":[  
            [  
               "e309fed3cd5ea3cae333625ebb1a8c44d42b5535",
               {  
                  "status":"partial",
                  "weight":1,
                  "choices":[  
                     {  
                        "content":"Straw",
                        "completed":false,
                        "selected":true,
                        "value":"7458406"
                     },
                     {  
                        "content":"Bricks",
                        "completed":true,
                        "selected":true,
                        "value":"3f512ac"
                     },
                     {  
                        "content":"Sticks",
                        "completed":true,
                        "selected":false,
                        "value":"90057e8"
                     },
                     {  
                        "content":"Pigs can't build houses.",
                        "completed":true,
                        "selected":true,
                        "value":"1bb75fd"
                     }
                  ],
                  "score":0.75,
                  "message":"",
                  "submissions":[  
                     "7458406",
                     "3f512ac",
                     "1bb75fd"
                  ]
               }
            ]
         ],
         "components":{  
            "block-v1:OpenCraft+MCKIN+6092+type@pb-mrq+block@da17b438bca348dd9610008fb6fbfadc":{  
               "student_choices":[  
                  "7458406",
                  "3f512ac",
                  "1bb75fd"
               ],
               "components":{  
                  "block-v1:OpenCraft+MCKIN+6092+type@pb-choice+block@230fa969e1db482ba01af20dd7cd1f5e":{  

                  },
                  "block-v1:OpenCraft+MCKIN+6092+type@pb-choice+block@2878035562f54d9d845400ee2937db4d":{  

                  },
                  "block-v1:OpenCraft+MCKIN+6092+type@pb-choice+block@1571c4a6f5b24f2685957b235609f7ae":{  

                  },
                  "block-v1:OpenCraft+MCKIN+6092+type@pb-choice+block@64da90498d7b4d51a436bc29ef8b13ab":{  

                  }
               }
            }
         }
      }
   }
}

Reviewers

Settings

EDXAPP_EXTRA_REQUIREMENTS:
   - name: git+https://github.com/open-craft/problem-builder.git@jill/MCKIN-6092#egg=xblock-problem-builder

to the data returned by Step Builder student_view_user_state
Copy link
Member

@mtyaka mtyaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks @pomegranited!

👍

  • I tested this: I followed the testing instructions in the PR description and verified the results.
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

@@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These integer counts are a bit redundant... but that's outside of scope of this PR.

@mtyaka mtyaka merged commit 673a753 into master Oct 5, 2017
@mtyaka mtyaka deleted the jill/MCKIN-6092 branch October 5, 2017 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants