Forums
Hello,
I'm already struggling a few days with this problem and I think I found a bug in the code, or I'm just being stupid and doing something wrong. In both cases, I hope you can help me with this.
I have a course with a few lessons. One of them is a theory lesson with only slides (no questions).
First I had set the minimum passing percentage of that lesson to 100%, but because there are no questions where a user can get any score, it will never pass that lesson.
So I decided to set the minimum passing percentage to 0%. This solved the first problem and users were able to pass the lesson.
A little while later, I noticed the rule "User has passed all required quizzes" was never fired anymore. With some debugging and digging I ran into this little piece of code, which is a conditional for the rule:
/profiles/opigno_lms/modules/opigno/opigno_quiz_app/opigno_quiz_app.rules.inc:133
<?php
/** * Condition: User has passed quiz. */
function opigno_quiz_app_rules_has_passed_quiz($node, $user) { $score = @current(quiz_get_score_data(array($node->nid), $user->uid)); return !empty($score->percent_score) && $score->percent_score >= $score->percent_pass;
}
?>
As you can see, there is a !empty($score->percent_score) part which will always return false in my case, because my $score->percent_score is always 0.
Shouldn't this be rewritten to fix this issue, or am I making a mistake and do I have to do this in another way?
Hopefully you can help me. Thanks in advance!
Bryan
Hi Bryan,
Hi Bryan,
Did you add this lesson in the "Lesson required for the course validation" of the course (field in the course interface)?
Hi BdN
Hi BdN
In fact you are right, thank you for finding this bug,
Instead of !empty($score->percent_score)
Please replace by (isset($score->percent_score))
We will add this to our new release or probably force the score to be 100 if it is of theory type.
https://www.drupal.org/node/2337533
http://drupalcode.org/project/opigno_quiz_app.git/commit/afd4a6c
Best regards
Thanks!
In reply to Hi BdN by James Aparicio
Hello, I applied the patch,
In reply to Hello, I applied the patch, by dottormeno
0
0