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

Competency user data is not being erased when user gets deleted

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Test 1 (upgrade)

      As this introduce a new upgrade step, do not upgrade. If you already did, create a separated branch and revert the commits of this issue.
       In order to fully test this change, we will need to create user data on competency tables related to user, run the upgrade and make sure all user data has been removed.
       Sorry, the testing instructions are a bit of pain, we want to fully remove user data.
      This requires a blank setup as it involves restore frameworks and courses that are dependent on ids

      1. Log in as admin.
      2. Go to Site administration > Competencies
      3. Import the attached competency framework ( CP1-1-20200115_2347-comma_separated.csv )
      4. Restore the attached course ( backup-moodle2-course-75-testcoursecompetency-20200116-0734-nu.mbz )
      5. Enrol an student into the course,* make note of this user id.*
      6. On the course, click on Competencies on the navigation drawer and check that the competency has been imported.
      7. Go to participants page, click on the user you have enrolled to go to his profile page.
      8. Under miscellaneous, click Learning plans.
      9. Click Add new learning plan button and add 2 new learning plans(LP1 and LP2) for that user.
        1. Set both to 'Active'
        2. With both add a competency from the imported competencies to the learning plans by clicking the 'Add competency' button after creating the plan.
      10. Log out and log in as student that you enrolled.
      11. Go to your profile page, under miscellaneous, click Learning plans.
      12. On the user learning plan page, and click Evidence of prior learning link
      13. Click Add new evidence button and add a new evidence.
        1. Attach a file as part of the evidence
      14. Once submitted, press "Link competencies" and choose the competency you imported earlier
      15. Click "Evidence of prior learning"
        1. Once submitted, click on the 'Edit' link and submit the evidence for review.
      16. Go to that course you are enrolled in.
      17. Complete this assignment (manually mark it as completed).
      18. Go to the database and query the files table using the following query

        select * from mdl_files order by id desc

      19. Note the ids for the file corresponding to the name of the evidence file submitted as part of #18
      20. As an admin, go to the user's profile page and click on the Learning plans.
        1. With LP1, click on the edit link and 'Complete the learning plan' 
        2. With LP2, go into the learning plan and click on the plan's competency 
          1. Click on the "LP2" in the Name column
          2. Click on the name for the competency
          3. Click Rate and rate it and close the modal
          4. Click on "Complete this learning plan" and confirm
        3. Click on "Learning plans" in the breadcrumbs
        4. Click on the 'Evidence of prior learning' link
          1. Click on evidence's name
          2. Click on the name of the competency in the 'Linked competencies' table
          3. Click the 'Rate' button 
          4. Set the competency rating and confirm.
      21. Go back to the course and choose "Competencies" in the navigation
      22. Select one of the linked competencies. (Click on the heading indicated by the arrow )
        1. Should take you to a page which lists the competency on a per user and competency basis with it filtered to the the student. If not filter it to the student and the selected competency. (e.g. )
      23. Rate the competency by clicking the rate button
      24. Now, go to your database and look the following tables:
        • Run the following queries and confirm there is data in the tables

          select * from mdl_competency_usercomp;
          select * from mdl_competency_evidence;
          select * from mdl_competency_usercompcourse;
          select * from mdl_competency_usercompplan;
          select * from mdl_competency_userevidencecomp;
          select * from mdl_competency_userevidence;
          select * from mdl_competency_plan;
          select * from mdl_competency_plancomp;
          

        • Have look on the tables for userid field and other foreign keys, for example competency_plancomp will use competency_plan id and etc. You can look on the patch thas has roughly the structure of tables.
      25. Log out and log in as admin.
      26. Go to Site administration > Users > Accounts > Browse list of users.
      27. Delete the student you used to submit the assignment.
      28. Now, upgrade!
      29. Go to your database and look the tables above for user data of the user you have deleted. 
      30. Repeat #24.1 and confirm that you do not see any data in them
      31. All user data related to that user id should now be removed.
      32. Repeat #18 and confirm the files from #19 do not exist.

       

      Test 2 (delete user hooks)

      Repeat the steps from the previous test:

      1. Repeat #5-27
      2. Repeat #29-32
      Show
      Test 1 (upgrade) As this introduce a new upgrade step, do not upgrade. If you already did, create a separated branch and revert the commits of this issue.  In order to fully test this change, we will need to create user data on competency tables related to user, run the upgrade and make sure all user data has been removed.  Sorry, the testing instructions are a bit of pain, we want to fully remove user data. This requires a blank setup as it involves restore frameworks and courses that are dependent on ids Log in as admin. Go to Site administration > Competencies Import the attached competency framework ( CP1-1-20200115_2347-comma_separated.csv ) Restore the attached course ( backup-moodle2-course-75-testcoursecompetency-20200116-0734-nu.mbz ) Enrol an student into the course,* make note of this user id.* On the course, click on Competencies on the navigation drawer and check that the competency has been imported. Go to participants page, click on the user you have enrolled to go to his profile page. Under miscellaneous, click Learning plans . Click Add new learning plan button and add 2 new learning plans(LP1 and LP2) for that user. Set both to 'Active' With both add a competency from the imported competencies to the learning plans by clicking the 'Add competency' button after creating the plan. Log out and log in as student that you enrolled. Go to your profile page, under miscellaneous, click Learning plans . On the user learning plan page, and click Evidence of prior learning link Click Add new evidence button and add a new evidence. Attach a file as part of the evidence Once submitted, press "Link competencies" and choose the competency you imported earlier Click "Evidence of prior learning" Once submitted, click on the 'Edit' link and submit the evidence for review. Go to that course you are enrolled in. Complete this assignment (manually mark it as completed). Go to the database and query the files table using the following query select * from mdl_files order by id desc Note the ids for the file corresponding to the name of the evidence file submitted as part of #18 As an admin, go to the user's profile page and click on the Learning plans. With LP1, click on the edit link and 'Complete the learning plan'  With LP2, go into the learning plan and click on the plan's competency  Click on the "LP2" in the Name column Click on the name for the competency Click Rate and rate it and close the modal Click on "Complete this learning plan" and confirm Click on "Learning plans" in the breadcrumbs Click on the 'Evidence of prior learning' link Click on evidence's name Click on the name of the competency in the 'Linked competencies' table Click the 'Rate' button  Set the competency rating and confirm. Go back to the course and choose "Competencies" in the navigation Select one of the linked competencies. (Click on the heading indicated by the arrow ) Should take you to a page which lists the competency on a per user and competency basis with it filtered to the the student. If not filter it to the student and the selected competency. (e.g. ) Rate the competency by clicking the rate button Now, go to your database and look the following tables: Run the following queries and confirm there is data in the tables select * from mdl_competency_usercomp; select * from mdl_competency_evidence; select * from mdl_competency_usercompcourse; select * from mdl_competency_usercompplan; select * from mdl_competency_userevidencecomp; select * from mdl_competency_userevidence; select * from mdl_competency_plan; select * from mdl_competency_plancomp; Have look on the tables for userid field and other foreign keys, for example competency_plancomp will use competency_plan id and etc. You can look on the patch thas has roughly the structure of tables. Log out and log in as admin. Go to Site administration > Users > Accounts > Browse list of users. Delete the student you used to submit the assignment. Now, upgrade! Go to your database and look the tables above for user data of the user you have deleted.  Repeat #24.1 and confirm that you do not see any data in them All user data related to that user id should now be removed. Repeat #18 and confirm the files from #19 do not exist.   Test 2 (delete user hooks ) Repeat the steps from the previous test: Repeat #5-27 Repeat #29-32
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE
    • Pull 3.7 Branch:
      MDL-60126-37-3
    • Pull 3.8 Branch:
      MDL-60126-38-3
    • Pull Master Branch:
      MDL-60126-master-3
    • Story Points:
      1
    • Sprint:
      Activity Sprint 2, Activity Sprint 3, Activity Sprint 4, Activity Sprint 5, Activity Sprint 6

      Description

      All the CBE related user data is not removed when the user gets deleted. We need to discuss and decide if all user data should be removed or just the data the user has added (eg. evidence).

      We should also consider deleting the users files related to competencies (eg. evidence files) and then in the upgrade add an adhoc step to be called which deals with the deletion.

      Please read comments on MDL-59994.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              peterdias Peter Dias
              Reporter:
              lameze Simey Lameze
              Peer reviewer:
              Mihail Geshoski
              Integrator:
              Andrew Nicols
              Tester:
              Anna Carissa Sadia
              Participants:
              Component watchers:
              Damyon Wiese, Jean-Philippe Gaudreau, Steve Massicotte, Serge Gauthier, Issam Taboubi, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              1 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Mar/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 days, 4 hours, 33 minutes
                  2d 4h 33m