Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-67788

Add xAPI statement support to mod_h5p

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.9
    • 3.9
    • H5P
    • MOODLE_39_STABLE
    • MOODLE_39_STABLE
    • MDL-67788-master
    • Hide

      Automated testings

      All new features classes have their own test:

      Manual Testing

      In the near future, this plugin will provide a report to list attempts and tracking information. For now the test requires to look at the DB to check the tracking information.

      Setup test:

      1. Check in your DB that your h5pactivity_attemps and h5pactivity_attempts_results are empty.
        1. SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts -> check that returns 0
        2. SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts_results -> check that returns 0
      2. If they are not empty delete all content (should not happen but if it's the second time you test this issue could be)
        1. SQL: DELETE FROM mdl_h5pactivity_attempts
        2. SQL: DELETE FROM mdl_h5pactivity_attempts_results

      Manual test (student tracking):

      1. Create a course with a H5P activity on it with the H5P attached in this issue (question-set-616.h5p).
      2. Enrol a student and access to the activity as this student
      3. Complete one attempt (3 questions, doesn't matter if you pass or fail)
      4. Remember your result and click on "Retry" 
      5. Repeat the attempt and remember the new result also (if possible, change some answer to generate different results)
      6. Once both attempts are done login as admin in the course and go "course administration -> reports -> logs" and show all today logs from the student.
      7. Check that 1 "H5P content viewed" and 8 xAPI statement received log entries appears.
      8. Now go to the DB select all rows from h5pactivity_attempts and:
        1. SQL: SELECT * FROM mdl_h5pactivity_attempts
          1. Check 2 attempts have been created with the student "userid"
          2. Check that the "rawscore" corresponds to both results you obtained.
      9. Now select all rows from h5pactivity_attempts_results and:
        1. SQL: SELECT * FROM mdl_h5pactivity_attempts_results
          1. Check that there are 4 rows with one attemptid and 4 with another (corresponding with the ids from h5pactivity_attempts)
          2. Check that on the rows from one attemptid the "interactiontype" are: 1 compound, 2 choice, 1 matching
          3. Check that only the rows with "compound" interactiontype have an empty "response" and "correctpattern".
      10. Go to the course and go to "course administration -> reset course"
        1. Check that in the form appears a header called "H5P activities" and inside it, there's an unchecked element called "Delete all H5P attempts"
        2. Click on "Select default" at the end of the form.
        3. Check that "Delete all H5P attempts" is now checked
      11. Uncheck  "Delete all H5P attempts" and click on "reset course" button
        1. Check that no errors appear
        2. Check that h5pactivity_attemps and h5pactivity_attemps_results still have all the attempts
          1. SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts -> check that returns 2
          2. SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts_results -> check that returns 8
      12. Go to the course and go to "course administration -> reset course"
      13. Click on "Select default" at the end of the form.
      14. Now click on "reset course"
        1. Check that no errors or warning appears and "Delete all H5P attempts" displays an OK.
        2. Check that both h5pactivity_attemps and h5pactivity_attempts_results are empty in the DB
          1. SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts -> check that returns 0
          2. SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts_results -> check that returns 0

      Manual test (admin no tracking, continuing from the previous test):

      1. Using the same scenario as before, login as admin and access the activity
      2. Check that a warning appears with the text "This content is displayed in preview mode. No attempt tracking will be stored."
      3. Answer all the questions and finish the activity
      4. Check that no new entries are created in h5pactivity_attemps and h5pactivity_attemps_results
        1. SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts -> check that returns 0
        2. SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts_results -> check that returns 0

      Testing more H5P contents

      This test will check that other H5P contents track as expected. For every file the process is the same:

      1. Remove all entries from attempts tables:
        1. SQL: DELETE FROM mdl_h5pactivity_attempts
        2. SQL: DELETE FROM mdl_h5pactivity_attempts_results
      2. Create an activity with the H5P package
      3. Login as student and finish the activity once (do not click on retry, we just wants to check one attempt now)
      4. Check on the DB that the information stored is similar than the one provided below this explanation
        1. SQL: SELECT * FROM mdl_h5pactivity_attempts -> check that one attempt is created.
        2. SQL: SELECT * FROM mdl_h5pactivity_attempts_results -> check the values specified on the next list

      List of files to check:

      1. Arithmetic quiz (file to use arithmetic-quiz.h5p) checks:
        1. interactiontype: other
        2. description: (empty)
        3. correctpattern: (empty)
        4. response: (empty)
        5.  additionals (XXX is any value): 

          {"extensions": {"http:\/\/h5p.org\/x-api\/h5p-local-content-id":XXX}
          ,"contextExtensions":{}}
          

        6. rawscore: (your score)
        7. maxscore: 5
      2. Multiple choice (file to use multiple-choice-713.h5p) checks:
        1. interactiontype: choice
        2. description: What color does the blackcurrant berry actually have?
        3. correctpattern(XXX is any value): ["XXX"]
        4. response: (an integer from 0 to 3)
        5.  additionals (XXX is any value):

           {"choices":\\\{"id":"0","description":{"en-US":"Very dark purple\n"}},\\\\{"id":"1","description":{"en-US":"Blue\n"}},\\\\{"id":"2","description":{"en-US":"Black\n"}},"extensions":{"http:\/\/h5p.org\/x-api\/h5p-local-content-id":16},"contextExtensions":{}}

        6. rawscore: (your score)
        7. maxscore: 1
      3. Interactive video (file interactive-video-2-618.h5p) checks:
        1. check that 6 h5pactivity_attemps_results are created
        2. check interactiontypes: compound, choice, fill-in, matching, choice, compound
        3. check only one "compound" entry have an empty "subcontent"
        4. check only "compound" entries have empty "correctpattern" and "response"
        5. check all anties have values in additionals, rawscore and maxscore 
      4. Fill the blanks (file fill-in-the-blanks-837.h5p)
        1. interactiontype: fill-in
        2. description: <p>Insert the missing words in this text about berries found in Norwegian... (text continues)
        3. correctpattern(XXX is any value):

          ["{case_matters=false}blue[,]Cloud[,]black"]

        4. response: (your respondes separated with "[,]")
        5. additionals (XXX is any value):

          {"extensions":{"http:\/\/h5p.org\/x-api\/h5p-local-content-id":XXX,"https:\/\/h5p.org\/x-api\/case-sensitivity":false,"https:\/\/h5p.org\/x-api\/alternatives":[["blue"],["Cloud"],["black"]]},"contextExtensions":{"https:\/\/h5p.org\/x-api\/h5p-reporting-version":"1.1.0"}}

        6. rawscore: (your score)
        7. maxscore: 3

       

       

       

      Show
      Automated testings All new features classes have their own test: PHPUnitTests: vendor/bin/phpunit -c mod/h5pactivity  https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/773/ Behat: execute behat with --tags=@mod_h5pactivity  https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/5238/ Manual Testing In the near future, this plugin will provide a report to list attempts and tracking information. For now the test requires to look at the DB to check the tracking information. Setup test: Check in your DB that your h5pactivity_attemps and h5pactivity_attempts_results are empty. SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts -> check that returns 0 SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts_results -> check that returns 0 If they are not empty delete all content (should not happen but if it's the second time you test this issue could be) SQL: DELETE FROM mdl_h5pactivity_attempts SQL: DELETE FROM mdl_h5pactivity_attempts_results Manual test (student tracking): Create a course with a H5P activity on it with the H5P attached in this issue ( question-set-616.h5p ). Enrol a student and access to the activity as this student Complete one attempt (3 questions, doesn't matter if you pass or fail) Remember your result and click on "Retry"  Repeat the attempt and remember the new result also (if possible, change some answer to generate different results) Once both attempts are done login as admin in the course and go "course administration -> reports -> logs" and show all today logs from the student. Check that 1 "H5P content viewed" and 8 xAPI statement received log entries appears. Now go to the DB select all rows from h5pactivity_attempts and: SQL: SELECT * FROM mdl_h5pactivity_attempts Check 2 attempts have been created with the student "userid" Check that the "rawscore" corresponds to both results you obtained. Now select all rows from h5pactivity_attempts_results and: SQL: SELECT * FROM mdl_h5pactivity_attempts_results Check that there are 4 rows with one attemptid and 4 with another (corresponding with the ids from h5pactivity_attempts) Check that on the rows from one attemptid the "interactiontype" are: 1 compound, 2 choice, 1 matching Check that only the rows with "compound" interactiontype have an empty "response" and "correctpattern". Go to the course and go to "course administration -> reset course" Check that in the form appears a header called "H5P activities" and inside it, there's an unchecked element called "Delete all H5P attempts" Click on "Select default" at the end of the form. Check that "Delete all H5P attempts" is now checked Uncheck   "Delete all H5P attempts" and click on "reset course" button Check that no errors appear Check that h5pactivity_attemps and h5pactivity_attemps_results still have all the attempts SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts -> check that returns 2 SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts_results -> check that returns 8 Go to the course and go to "course administration -> reset course" Click on "Select default" at the end of the form. Now click on "reset course" Check that no errors or warning appears and "Delete all H5P attempts" displays an OK. Check that both h5pactivity_attemps and h5pactivity_attempts_results are empty in the DB SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts -> check that returns 0 SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts_results -> check that returns 0 Manual test (admin no tracking, continuing from the previous test): Using the same scenario as before, login as admin and access the activity Check that a warning appears with the text "This content is displayed in preview mode. No attempt tracking will be stored." Answer all the questions and finish the activity Check that no new entries are created in h5pactivity_attemps and h5pactivity_attemps_results SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts -> check that returns 0 SQL: SELECT COUNT( * ) FROM mdl_h5pactivity_attempts_results -> check that returns 0 Testing more H5P contents This test will check that other H5P contents track as expected. For every file the process is the same: Remove all entries from attempts tables: SQL: DELETE FROM mdl_h5pactivity_attempts SQL: DELETE FROM mdl_h5pactivity_attempts_results Create an activity with the H5P package Login as student and finish the activity once (do not click on retry, we just wants to check one attempt now) Check on the DB that the information stored is similar than the one provided below this explanation SQL: SELECT * FROM mdl_h5pactivity_attempts -> check that one attempt is created. SQL: SELECT * FROM mdl_h5pactivity_attempts_results -> check the values specified on the next list List of files to check: Arithmetic quiz (file to use  arithmetic-quiz.h5p ) checks : interactiontype: other description: (empty) correctpattern: (empty) response: (empty)  additionals (XXX is any value):  {"extensions": {"http:\/\/h5p.org\/x-api\/h5p-local-content-id":XXX} ,"contextExtensions":{}} rawscore: (your score) maxscore: 5 Multiple choice (file to use multiple-choice-713.h5p ) checks : interactiontype: choice description: What color does the blackcurrant berry actually have? correctpattern(XXX is any value): ["XXX"] response: (an integer from 0 to 3)  additionals (XXX is any value): {"choices":\\\{"id":"0","description":{"en-US":"Very dark purple\n"}},\\\\{"id":"1","description":{"en-US":"Blue\n"}},\\\\{"id":"2","description":{"en-US":"Black\n"}},"extensions":{"http:\/\/h5p.org\/x-api\/h5p-local-content-id":16},"contextExtensions":{}} rawscore: (your score) maxscore: 1 Interactive video (file interactive-video-2-618.h5p ) checks : check that 6 h5pactivity_attemps_results are created check interactiontypes: compound, choice, fill-in, matching, choice, compound check only one "compound" entry have an empty "subcontent" check only "compound" entries have empty "correctpattern" and "response" check all anties have values in additionals, rawscore and maxscore  Fill the blanks (file fill-in-the-blanks-837.h5p ) interactiontype: fill-in description: <p>Insert the missing words in this text about berries found in Norwegian... (text continues) correctpattern(XXX is any value): [ "{case_matters=false}blue[,]Cloud[,]black" ] response: (your respondes separated with " [,] ") additionals (XXX is any value): {"extensions":{"http:\/\/h5p.org\/x-api\/h5p-local-content-id":XXX,"https:\/\/h5p.org\/x-api\/case-sensitivity":false,"https:\/\/h5p.org\/x-api\/alternatives":[["blue"],["Cloud"],["black"]]},"contextExtensions":{"https:\/\/h5p.org\/x-api\/h5p-reporting-version":"1.1.0"}} rawscore: (your score) maxscore: 3      

      Implement the required classes to use xAPI statement post inside mod_h5p.

      This implementation requires:

      • Implement the extension of xapi_statement_base as \mod_h5p\xapi_handler class which override:
        • statement_to_event: convert a xAPI statement to a mod_h5p event (plus programming that event)
      • Add xAPI LRS URL to mod_h5p player and implement the JS method to send xAPI statements from the H5P content
      • Code behat tests

       

        1. arithmetic-quiz.h5p
          731 kB
        2. fill-in-the-blanks-837.h5p
          1.46 MB
        3. interactive-video-2-618.h5p
          3.03 MB
        4. multiple-choice-713.h5p
          1.49 MB
        5. Privacy - Screenshot 2020-03-27 at 12.38.36.png
          Privacy - Screenshot 2020-03-27 at 12.38.36.png
          194 kB
        6. question-set-616.h5p
          2.92 MB
        7. Screenshot_1.png
          Screenshot_1.png
          179 kB
        8. Screenshot_2.png
          Screenshot_2.png
          200 kB
        9. Screenshot_3.png
          Screenshot_3.png
          143 kB
        10. Screenshot_4.png
          Screenshot_4.png
          111 kB
        11. Screenshot_5.png
          Screenshot_5.png
          216 kB
        12. Screenshot_6.png
          Screenshot_6.png
          104 kB

            tusefomal Ferran Recio
            tusefomal Ferran Recio
            Carlos Escobedo Carlos Escobedo
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 weeks, 3 days, 5 hours, 36 minutes
                3w 3d 5h 36m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.