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

Task cohort_role_sync development error when the same user is into two cohorts

    XMLWordPrintable

Details

    • MOODLE_35_STABLE
    • MOODLE_33_STABLE, MOODLE_34_STABLE
    • MDL-61421-master
    • Hide

      Setup

      1. Create a Cohort 1
      2. Create a Cohort 2
      3. Add a user X to the Cohort 1
      4. Add the same user X to the Cohort 2
      5. Create a Role which can be assigned at the user level

      Testing scenario

      1. Go to Site administration / ► Users / ► Permissions / ► Assign user roles to cohort
      2. Choose a user Y from the 'Select users to assign role' dropdown
      3. Select the Cohort 1 and Cohort 2 from the 'Select cohorts' dropdown
      4. Click Assign
      5. Run the scheduled task

        php admin/tool/task/cli/schedule_task.php --execute=tool_cohortroles\\task\\cohort_role_sync --showdebugging

        • CHECK no errors appears during the task execution.

       

      Show
      Setup Create a Cohort 1 Create a Cohort 2 Add a user X to the Cohort 1 Add the same user X to the Cohort 2 Create a Role which can be assigned at the user level Testing scenario Go to Site administration / ► Users / ► Permissions / ► Assign user roles to cohort Choose a user Y from the 'Select users to assign role' dropdown Select the Cohort 1 and Cohort 2 from the 'Select cohorts' dropdown Click Assign Run the scheduled task php admin/tool/task/cli/schedule_task.php --execute=tool_cohortroles\\task\\cohort_role_sync --showdebugging CHECK no errors appears during the task execution.  

    Description

      Task cohort_role_sync attempts to sync users and fails when two cohorts have a common user.

      Steps to replicate

      1. Create a Cohort 1
      2. Create a Cohort 2
      3. Add a user X to the Cohort 1
      4. Add the same user X to the Cohort 2
      5. Create a Role which can be assigned at the user level
      6. Go to Site administration / ► Users / ► Permissions / ► Assign user roles to cohort
      7. Choose a user Y from the 'Select users to assign role' dropdown
      8. Select the Cohort 1 and Cohort 2 from the 'Select cohorts' dropdown
      9. Click Assign
      10. Run the scheduled task (php admin/tool/task/cli/schedule_task.php --execute=tool_cohortroles\\task
        cohort_role_sync --showdebugging
        )

      You will get the next message:

      ++ Did you remember to make the first column something unique in your call to get_records? Duplicate value '8' found in column 'userid'. ++

       

      Attachments

        Activity

          People

            sarjona Sara Arjona (@sarjona)
            cirano David Herney Bernal
            Dan Marsden Dan Marsden
            Andrew Lyons Andrew Lyons
            Janelle Barcega Janelle Barcega
            David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              19/Mar/18

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h