Problem
The system has marked the student as completing an activity even though the student received a grade of 'Fail'.
Solution
Require grade
When this option is ticked, students have to get a grade on the activity in order to complete it. For example, a quiz would be marked completed as soon as the user submits it (so long as it doesn't contain any "essay" questions).
It does not matter how well the student did. Getting any grade will mark the activity completed.