Steps to reproduce:
- In a quiz, Add Question: Copy from Question Pool
- Select a pool with questions
- Select a few questions from the pool and import
- Notice the questions will be imported with the same 'number' (sequence number)
- Try to change one of the questions that has the same 'number' as another question
- Notice that all questions with the same number will be changed to the number selected in the previous step
The problem is some over-complication in the algorithm that is copying the questions. During testing, we didn't immediately become aware of this because we were focused solely on the order in which the questions were imported into the quiz (which does preserve the order). However, we didn't notice the problem with the 'sequence' number until a few days ago.
The attached patch fixes the function performing the copy/sort by reverting some of the original functionality, and by changing the sorted collection from a TreeMap to a TreeSet.