Here is a link to a plugin that does just that. Not sure if it will work with your version of Moodle but worth a try!
https://github.com/jamiepratt/moodle-mod_quiz_accessrule_gradebycategory
Here is a link to a plugin that does just that. Not sure if it will work with your version of Moodle but worth a try!
https://github.com/jamiepratt/moodle-mod_quiz_accessrule_gradebycategory