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

Plan created from cohort and deleted are recreated by sync task

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: None
    • Component/s: Competencies
    • Labels:
    • Testing Instructions:
      Hide

      For these tests you should change the value $maxtocreate in admin/tool/lp/template_cohorts.php. otherwise you will have to create cohorts with more than 50 users to execute the tests.

      Create 5 users.
      Create 2 cohorts with 2 different users in each.

      Create a learning template and set is not visible.
      Run the sync task:

      php admin/tool/task/cli/schedule_task.php --execute=\\tool_lp\\task\\sync_plans_from_template_cohorts_task
      

      Check that no plans were created.

      Set the learning plan template to visible and run the sync task.
      Check that plans were created for each user in the cohort.

      Create an second template and make it visible.
      Add the second cohort to the second template.
      Edit each cohort and add the user that is not associated to any cohort.
      Run the sync task.
      Go to learning plans templates.
      Check that plans is created with first template for the new user in first cohort.
      Check that plans are created with second template for the all users in second cohort.

      For the first template add the second cohort.
      Run the sync task.
      Check that plans were created for users in second cohort.

      Go the user learning plans (in profile) and delete one of his plans.
      Run the sync task.
      Check the plan was not recreated.

      Run UnitTest

      mdk phpunit -r -s tool_lp_testsuite
      

      Show
      For these tests you should change the value $maxtocreate in admin/tool/lp/template_cohorts.php. otherwise you will have to create cohorts with more than 50 users to execute the tests. Create 5 users. Create 2 cohorts with 2 different users in each. Create a learning template and set is not visible. Run the sync task: php admin/tool/task/cli/schedule_task.php --execute=\\tool_lp\\task\\sync_plans_from_template_cohorts_task Check that no plans were created. Set the learning plan template to visible and run the sync task. Check that plans were created for each user in the cohort. Create an second template and make it visible. Add the second cohort to the second template. Edit each cohort and add the user that is not associated to any cohort. Run the sync task. Go to learning plans templates. Check that plans is created with first template for the new user in first cohort. Check that plans are created with second template for the all users in second cohort. For the first template add the second cohort. Run the sync task. Check that plans were created for users in second cohort. Go the user learning plans (in profile) and delete one of his plans. Run the sync task. Check the plan was not recreated. Run UnitTest mdk phpunit -r -s tool_lp_testsuite
    • Affected Branches:
      MOODLE_31_STABLE
    • Pull Master Branch:
      MDL-52561_master
    • Story Points:
      3
    • Sprint:
      CBE Sprint 4, CBE Sprint 5

      Description

      When we delete a user plan created from a template and a cohort all information associated to the plan is deleted from the database. So when the scheduled task to sync plans runs, it recreates the plan because there is no way to know that the plan was there before.

        Attachments

          Activity

            People

            Assignee:
            sergeg55 Serge Gauthier
            Reporter:
            sergeg55 Serge Gauthier
            Peer reviewer:
            Frédéric Massart
            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:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: