How to reset quiz questions

Hi,
I’ve created a quiz in a module and added the course assessment extension. When a user passes the quiz I don’t want them to be able to retake it, but if they fail I want the questions to be reset so that they have to answer them all again.
However, if a user fails the quiz and leaves the module to return later, their previous answers are still there and there is not an option to retake the quiz. I’ve obviously got a setting wrong, but I can’t work out which; I’ve looked at the guidance on the Evolve hub, but it didn’t help.
Has anyone got any suggestions please?