mdjnelson / moodle-mod_customcert

Enables the creation of dynamically generated certificates with complete customisation via the web browser.
https://moodle.org/plugins/mod_customcert
GNU General Public License v3.0
91 stars 158 forks source link

Course grade on certificate does not respect exclude empty grades in gradebook #445

Closed cam-howard closed 2 years ago

cam-howard commented 3 years ago

Hi Mark,

Thanks again for the Custom certificate plugin for Moodle; it's very helpful.

I have run into an issue where the grade reported on the custom certificate does not match the course total in the gradebook. We are using version 3.9.1.

Summary: If the gradebook is set to exclude empty grades, those empty grades are still included in the course grade reported on the custom certificate, resulting in a lower grade on the custom certificate than is reported in the gradebook (causing students much concern).

Steps to reproduce the issue

  1. Create a test course with four graded learning activities and a couple of students. (The number of activities and students is not crucial, it's just what I used for testing.)

  2. Set up the gradebook with these settings:

    • Aggregation: Natural
    • Exclude empty grades: No
  3. Create two categories with these settings:

    • Category One
      • Aggregation: Natural
      • Exclude empty grades: Yes
    • Category Two
      • Aggregation: Natural
      • Exclude empty grades: No
  4. Add two learning activities to each category.

  5. Assign grades to students as follows:

    • Category One
      • Student 1: Grade both activities
      • Student 2: Grade one activity and leave the other ungraded
    • Category Two
      • Student 1: Grade both activities
      • Student 2: Grade both activities
  6. Create a custom certificate that includes Grade item: Course grade.

  7. Compare each student's course total in the gradebook with the course grade reported on the custom certificate.

  8. Note that for Student 2, the grade on the custom certificate will be lower than the grade in the gradebook.

  9. Return to the gradebook and edit Category One to change Exclude empty grades from Yes to No.

  10. Compare each student's course total in the gradebook with the course grade reported on the custom certificate.

  11. Note that the grade on the custom certificate will now match the grade in the gradebook for both students.

  12. Return to the gradebook and edit both the course grade settings and Category One settings to set Exclude empty grades to Yes.

  13. Compare each student's course total in the gradebook with the course grade reported on the custom certificate.

  14. Note that for Student 2, the grade on the custom certificate will again be lower than the grade in the gradebook.

It appears the course grade item on the custom certificate is not respecting the exclude empty grades setting in the gradebook and thus reporting a lower grade than the gradebook when Exclude empty grades is set to Yes.

I expected the custom certificate to simply report the course total from the gradebook without doing it's own calculation. That doesn't seem to be the case.

This may or may not be related to "Course grade on certificate is different to the gradebook" (issue #395 ). Markibacsi, who opened that issue, doesn't specify whether or not exclude empty grades was being used in that course. Based on Markibacsi's description and the screenshot in that issue, it's possible that is the case.

I looked at the logic you linked to in that issue, but PHP is not my strength.

I'm hoping this additional information pointing to an issue with exclude empty grades will help find a fix.

Thanks, Cam

mdjnelson commented 3 years ago

Ah great, thanks Cam! Will have to replicate this when I get a chance.

mdjnelson commented 2 years ago

Looking into this now, thanks for the replication steps. Let's see what I find. :)

mdjnelson commented 2 years ago

Hi Cam,

When I got to step 7 Student 1's grade was '260.00' on the certificate and '260.00' in the Gradebook. Student 2's grade was '195.00' on the certificate and '195.00' in the Gradebook. So, I was not able to replicate the issue. Do you think perhaps I missed a step to get those grades?

I attached a snippet from the Gradebook on my test site.

Screenshot from 2021-09-28 21-08-28