When a user elects to import questions from a question pool into an assessment, the sort order in the table provided is based on question text (title). However, after the import the questions may seem randomized to the user, in that the sort order is not preserved.
The code is accessing the selected pools based on question ID from the previous interface (the selection table), which can be out of order for a number of reasons.
This can cause confusion for the end user, who typically expects the sorting based on title to be preserved. It can be aggravating and arduous for them to preserve this order manually, as they would have to select and add each question from the pool one by one.
The attached patch preserves the sort order based on question text (title) by adding the questions to a sorted collection first, then copies the questions to the assessment.