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

Participants selector will render participant name against wrong id

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Please test this explicitly in the 3 branches (31, 32 & master)

      1. # Enrol 4 students in a course with an assignment
      2. Get two of the users submit the assignment
      3. As a teacher, go to the assignment grading interface
      4. Filter the user selector by 'not submitted'
      5. Press the down button on the list of users, and select each student

      VERIFY: that each user selected from the selector redirects you to the correct user listed, not someone else!

      Play around with the filters and verify the parcipants dropdown functions as would be expected

      Show
      Please test this explicitly in the 3 branches (31, 32 & master) # Enrol 4 students in a course with an assignment Get two of the users submit the assignment As a teacher, go to the assignment grading interface Filter the user selector by 'not submitted' Press the down button on the list of users, and select each student VERIFY: that each user selected from the selector redirects you to the correct user listed, not someone else! Play around with the filters and verify the parcipants dropdown functions as would be expected
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Pull Master Branch:
      MDL-57604-master

      Description

      Steps to reproduce:

      1. Enrol 4 students in a course
      2. Make two users submit the assignment
      3. Filter the selector by 'not submitted'
      4. Press the down button on the list of users, and select each one

      Expected results:

      1. The student you select will be chosen

      Actual results:

      1. You can sometimes get another random user different to what you chose because the logic when filtering is completely screwed, see below..

      This is how I found it:

      I was studying this code: https://github.com/moodle/moodle/blob/master/mod/assign/amd/src/participant_selector.js#L70

      And seems there is a logic bug:

      1) We have an array of students and we iterate through them
      2) We filter the students and only conditionally render a template for them based on certain conditions
      3) But we then attach the result of a render to the original students array indexed by the promise, not taking account of the fact the index might not match the render index

      For example:

      [{id: 1, name: Bob, show: false},
      {id: 2, name: Fred, show: true},
      {id: 3, name: Ryan, show: true}]
      

      Would result in:

      [{id: 1, name: Bob, show: false, label: '<p>Fred</p>'},
      {id: 2, name: Fred, show: true,  label: '<p>Ryan</p>'},
      {id: 3, name: Ryan, show: true}]
      

      I probably some work on actual steps to reproduce now..

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Mar/17