To do that, you'll have to get comfortable with trigger conditions and variables:
Because you want to present the module(s) based on what questions they answer incorrectly, you'll need variables to track incorrect responses.
- The simplest might be to use a T/F variable, with a default of False. Add a trigger to the Correct layer that adjusts the associated variable to True. Then, later, you know that the question was answered incorrectly if the variable is still False.
You'll need to re-program the Results slides so that the user won't see the Retake Quiz button until after they complete the appropriate modules. In such a case, I'd probably divert them immediately to a custom menu slide.
To require only certain modules, you'd have to control navigation based on what questions they got wrong. And then allow them to return to the Results slide, with the Retake Quiz button available.
As you can probably tell, how complicated the programming will be depends on how many questions you have and how they are associated with different modules. So it'd be best to carefully plan things out before you actually start programming.
For simpler programming, you could make them take the whole course if they fail the pre-test. Then you'd just need to steer them to the content from the Failure layer.