A Teacher imported some (but not all) content from Course 1 into Course 2. In Course 2 the Teacher then setup a quiz that pulls it's questions randomly from a question category that was imported. The Teacher reviewed the imported questions for the quiz. They didn't modify them but they did click "Save" for each question in the category. Later the Teacher imported a few more file resources from Course 1 into Course 2. The questions were duplicated in the category and some students where given 2 copies of some questions on their quiz.
I'm not sure what part to point at and say "That's not right" in order to begin to write a patch.