I suspect that this is an earlier possible problem with quizzes. Quizzes are marked complete, even if they are failed. The criterion the badge should use should be "Completed-Passed" not "Completed". I actually think this is a bit of extra work but makes a lot more sense,
I guess other activities are completed if they are viewed so I can't suggest a work around. I used a certificate with a view criterion the work around the problem.. Once they pass the test and "view" their certificate (which is invisible until they pass it), they get the badge.
I'm hoping no one thinks certificates and badges are redundant, since the certificate has their grade and the badge does not.