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

    • Testing Instructions:
      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.  
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-61421-master

      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

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                19/Mar/18

                Time Tracking

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