Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 3.1.4, 3.2.1, 3.3
-
Component/s: Assignment
-
Labels:
-
Testing Instructions:
-
Affected Branches:MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE
-
Fixed Branches:MOODLE_31_STABLE, MOODLE_32_STABLE
-
Pull from Repository:
-
Pull Master Branch:
MDL-57604-master -
Pull Master Diff URL:
Description
Steps to reproduce:
- Enrol 4 students in a course
- Make two users submit the assignment
- Filter the selector by 'not submitted'
- Press the down button on the list of users, and select each one
Expected results:
- The student you select will be chosen
Actual results:
- 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..