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

Attempts should be removed when H5P activity is deleted from a course

XMLWordPrintable

    • MOODLE_400_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE
    • MDL-77224-401
    • MDL-77224-402
    • Hide

      Setup

      1. Log in as admin
      2. Navigate to Server > Tasks > Scheduled tasks in site administration
      3. Run the Download available H5P content types from h5p.org task manually (if it hasn't already run)
      4. Navigate to site content bank
      5. Add an Arithmetic Quiz item
        • Title: Mine
        • Max number of questions: 2

      Before applying patch

      1. Create a user
      2. Create a course
      3. Enrol user as student on course
      4. Create three H5P activities
        • Select the item from the content bank you previously created for each
      5. Log out
      6. Log in as test user
      7. Complete each of the three H5P activities in the course
      8. Log out
      9. Log in as admin
      10. Delete the first H5P activity
      11. Run cron to ensure the activity is fully removed
      12. Execute the following query:

        SELECT * FROM moodle.m_h5pactivity_attempts;
        

      13. Confirm it returns attempt data for all three activities
      14. Execute the following query:

        SELECT * FROM moodle.m_h5pactivity_attempts_results;
        

      15. Confirm it returns attempt result data for all three activities

      After applying patch

      1. Run upgrade step
      2. Re-run previous queries, confirm that attempt/result data for the first activity has been removed
      3. Confirm that attempt/result data for the existing activities has been retained
      4. Delete the second H5P activity
      5. Run cron to ensure the activity is fully removed
      6. Re-run previous queries, confirm that attempt/result data for the second activity has been removed
      7. Confirm that attempt/result data for the third activity has been retained
      Show
      Setup Log in as admin Navigate to Server > Tasks > Scheduled tasks in site administration Run the Download available H5P content types from h5p.org task manually (if it hasn't already run) Navigate to site content bank Add an Arithmetic Quiz item Title: Mine Max number of questions: 2 Before applying patch Create a user Create a course Enrol user as student on course Create three H5P activities Select the item from the content bank you previously created for each Log out Log in as test user Complete each of the three H5P activities in the course Log out Log in as admin Delete the first H5P activity Run cron to ensure the activity is fully removed Execute the following query: SELECT * FROM moodle.m_h5pactivity_attempts; Confirm it returns attempt data for all three activities Execute the following query: SELECT * FROM moodle.m_h5pactivity_attempts_results; Confirm it returns attempt result data for all three activities After applying patch Run upgrade step Re-run previous queries, confirm that attempt/result data for the first activity has been removed Confirm that attempt/result data for the existing activities has been retained Delete the second H5P activity Run cron to ensure the activity is fully removed Re-run previous queries, confirm that attempt/result data for the second activity has been removed Confirm that attempt/result data for the third activity has been retained

      While working on MDL-67789, I've realised the attempts information (entries in h5pactivity_attempts and h5pactivity_attempts_results) is not removed in h5pactivity_delete_instance() when an H5P activity is deleted from a course.

      Apart from removing this information, some extra code should be added in the upgrade, to guarantee old orphan entries are removed too.

            pholden Paul Holden
            sarjona Sara Arjona (@sarjona)
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Andrew Lyons Andrew Lyons
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 35 minutes
                2h 35m

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