Non-core contributed modules

Required Grades in uses points instead of percentage for locking

Details

  • Database:
    Any
  • Affected Branches:
    MOODLE_19_STABLE

Description

When locking certificate issuance to a minimum course grade the select box uses percentages. However, when actually determining whether the certificate should be issued, the certificate uses points instead of the course percentage. Language file also needs to be updated since $coursegrade->percentage includes "%" in string. This is a problem at least in the 1.9 version (1.7 worked fine), version date 2008080901, version number 3.1.9. Below code seems to fix it.

--in lib.php--
LINE 1384: if ($certificate->requiredgrade > $coursegrade->points) {
> SHOULD BE: if ($certificate>requiredgrade > $coursegrade->percentage) {
LINE 1385: $a->current = $coursegrade->points;
> SHOULD BE: $a>current = $coursegrade->percentage;

--in lang/en_utf8/certificate.php--
LINE 101: $string['errorlockgradecourse'] = 'Your current course grade ($a->current%%) is below the grade required ($a->needed%%) to receive your certificate.';
-> SHOULD BE: $string['errorlockgradecourse'] = 'Your current course grade ($a->current) is below the grade required ($a->needed%%) to receive your certificate.';

Activity

Hide
Jonathan Schmidt added a comment -

Duh, it makes more sense to use abs():
1385: if ($certificate->requiredgrade > abs($coursegrade->percentage)) {

1386: $a->current = abs($coursegrade->percentage);

and lang/.../certificate.php needn't be changed at all.

Show
Jonathan Schmidt added a comment - Duh, it makes more sense to use abs(): 1385: if ($certificate->requiredgrade > abs($coursegrade->percentage)) { 1386: $a->current = abs($coursegrade->percentage); and lang/.../certificate.php needn't be changed at all.
Hide
Chris Follin added a comment -

Thank you, Jonathan. Your recommended changes fixed the issue for us.

Show
Chris Follin added a comment - Thank you, Jonathan. Your recommended changes fixed the issue for us.
Hide
Micky Fokken added a comment -

Jonathan,
I updated my certificate > lib.php but it doesn't fix the issue. I have Moodle 1.9.9. My certificate version is 2009080900. Does your fix apply to these versions?

Line 1425 - changed to
if ($certificate->requiredgrade > abs($coursegrade->percentage)) {

Line 1426 - changed to
$a->current = abs($coursegrade->percentage);

Here is the forum post tracking this issue:
http://moodle.org/mod/forum/discuss.php?d=172846#p757681

Show
Micky Fokken added a comment - Jonathan, I updated my certificate > lib.php but it doesn't fix the issue. I have Moodle 1.9.9. My certificate version is 2009080900. Does your fix apply to these versions? Line 1425 - changed to if ($certificate->requiredgrade > abs($coursegrade->percentage)) { Line 1426 - changed to $a->current = abs($coursegrade->percentage); Here is the forum post tracking this issue: http://moodle.org/mod/forum/discuss.php?d=172846#p757681
Hide
Jonathan Schmidt added a comment -

I don't know, we haven't upgraded to that version of the certificate yet, though with the change from points to percentage I'd think the change would be applicable. Appears to be the same problem, at least.

We also have multiple SCORMs in our courses for which the grading method in each is Highest Grade. Additionally, SCORM is set with a maximum grade of 100 and the certificate has each SCORM as a separate dependent activity so each has a required grade of 70%, in addition to the total course requirement of 70% (without doing this, 100% grades in 70% of the SCORMs produces a passing course grade and the student can skip the last modules).

We have some other settings applied to the total course, but the certificate does most of the work itself, as I recall, so these only have a bearing on the gradebook and not the certificate issuance.

Show
Jonathan Schmidt added a comment - I don't know, we haven't upgraded to that version of the certificate yet, though with the change from points to percentage I'd think the change would be applicable. Appears to be the same problem, at least. We also have multiple SCORMs in our courses for which the grading method in each is Highest Grade. Additionally, SCORM is set with a maximum grade of 100 and the certificate has each SCORM as a separate dependent activity so each has a required grade of 70%, in addition to the total course requirement of 70% (without doing this, 100% grades in 70% of the SCORMs produces a passing course grade and the student can skip the last modules). We have some other settings applied to the total course, but the certificate does most of the work itself, as I recall, so these only have a bearing on the gradebook and not the certificate issuance.
Hide
Micky Fokken added a comment -

Thank you for the feedback. I changed the SCORMs to Highest Grade and the certificate works without applying the code changes above. Certificate still doesn't work with the Grading Method, Learning Object.

Show
Micky Fokken added a comment - Thank you for the feedback. I changed the SCORMs to Highest Grade and the certificate works without applying the code changes above. Certificate still doesn't work with the Grading Method, Learning Object.

People

Vote (3)
Watch (5)

Dates

  • Created:
    Updated: