Non-core contributed modules

Wrong grade displayed on the Certificate when there are multiple quiz attempts

Details

  • Type: New Feature New Feature
  • Status: Open Open
  • Priority: Blocker Blocker
  • Resolution: Unresolved
  • Affects Version/s: 1.9.4
  • Fix Version/s: None
  • Component/s: Module: Certificate
  • Labels:
    None
  • Environment:
    Windows Server 2003 R2, MSSQL 2005, IIS 6, PHP 5.2.6
  • Database:
    Microsoft SQL
  • Affected Branches:
    MOODLE_19_STABLE

Description

When a student completes a quiz and then clicks the certificate link in the course the Certificate module generates the certificate by inserting a new record into the certificate_issues table. This record contains various details about the certificate, including the DATE that the certificate was issued (certdate) and the GRADE that the student obtained (reportgrade). Then, if the certification requirements have been met (required grade, etc.), the PDF library in Moodle creates the certificate and displays it to the student. So far everything is great.

Then the student goes and attempts the quiz again. When this second attempt is submitted the Certificate module adds another record to the grade_grades_history table with old values from the oldid, source, timemodified, itemid, rawgrade, rawgrademax and usermodified columns.

Then it UPDATES the 'grade' and 'timemodified' values of the record in the quiz_grades table.

Then it ADDS a new record to the quiz_attempts table containing the new attempt number, new grade, timestart, timefinish and timemodified values.

Then it UPDATES the questions, sum_grades and grade column values of the original quiz record in the quiz table (the original submission).

The next thing that the Certificate module SHOULD do is UPDATE the record for the original certificate (that was previously issued) on the certificate_issues table (which still contains the original reportgrade and certdate values). But the module DOES NOT do this last update and that is why the grade for the last attempt is not displayed! The module should be updating (or deleting???) the original certificate record on certificate_issues with the date and grade details of the most recent attempt that the student submitted.

Alternatively, the certification date and grade details shouldn't even be stored on this table. Instead, the Certificate module should retrieve the latest grade details from the grade_grades table whenever the user requests the certificate. I think that this is a better solution...

I haven't yet figured out what code needs to be updated to make sure that the above record update is performed, but this is, as far as I can see, the cause of the problem.

Would adding a call to update_record(certificate_issues, $???) somewhere in the \certificate\view.php page be a viable solution? If I read the Xref documentation for Update_record() correctly this would update the record in the certificate_issues table with the most recent grade and date. If so, what would the second parameter for update_record() be?

See discussion in http://moodle.org/mod/forum/discuss.php?d=108397 where other users have reported the same or similar problem.

Activity

Hide
Chardelle Busch added a comment -

First, the certificate doesn't do anything to the grades tables (at least it better not), it only retrieves information from them.

As for updating the certificate_issues table. This has been discussed before. Here is the reasoning. Each certificate is issued with a validation code, and the certificate can then be validated by entering this code using the certificate validation block. The vital information that is issued on a certificate should NOT ever change! This is for security reasons. Imagine the confusion of validating a certificate if the information changes in the database.

If you want to have multiple quiz attempts then either
1. Don't let students get their certificate until they have completed all quiz attempts, or
2. Issue them a second certificate with the new quiz grade.

Show
Chardelle Busch added a comment - First, the certificate doesn't do anything to the grades tables (at least it better not), it only retrieves information from them. As for updating the certificate_issues table. This has been discussed before. Here is the reasoning. Each certificate is issued with a validation code, and the certificate can then be validated by entering this code using the certificate validation block. The vital information that is issued on a certificate should NOT ever change! This is for security reasons. Imagine the confusion of validating a certificate if the information changes in the database. If you want to have multiple quiz attempts then either 1. Don't let students get their certificate until they have completed all quiz attempts, or 2. Issue them a second certificate with the new quiz grade.
Hide
Luis de Vasconcelos added a comment -

Thanks Chardelle.
How do you issue a second certificate?

Show
Luis de Vasconcelos added a comment - Thanks Chardelle. How do you issue a second certificate?
Hide
Luis de Vasconcelos added a comment -
Show
Luis de Vasconcelos added a comment - A related post by Chardelle: http://moodle.org/mod/forum/discuss.php?d=115688
Hide
Dustin Elliott added a comment - - edited

I have a similar situation but adding a second certificate is not a feasible solution. The certificates we issue expire every two years at which point the student will need to retake the course to get a new certificate with a new date. Therefore, I would have to add a new certificate to the course every 2 years. After 4 years there would be 3 certificates, after 6 there would be 4...See the problem?

I would be fine with a solution where 2 years (or an amount of time I could set) from the issue date the certificates were deleted out of the database.

How about making a report that would list all certificates with an issue date prior to a specified date and then allow the returned records to be deleted? Automating something like that to run once a day, week, or month would be great but not totally necessary.

Show
Dustin Elliott added a comment - - edited I have a similar situation but adding a second certificate is not a feasible solution. The certificates we issue expire every two years at which point the student will need to retake the course to get a new certificate with a new date. Therefore, I would have to add a new certificate to the course every 2 years. After 4 years there would be 3 certificates, after 6 there would be 4...See the problem? I would be fine with a solution where 2 years (or an amount of time I could set) from the issue date the certificates were deleted out of the database. How about making a report that would list all certificates with an issue date prior to a specified date and then allow the returned records to be deleted? Automating something like that to run once a day, week, or month would be great but not totally necessary.
Hide
Chardelle Busch added a comment -

I changed this to a new feature request since it is not a bug.

1. Add option to reissue the certificate.
2. Change/add code to create a new certificate_issues record each time someone clicks on a certificate that is set to "reissue" (e.g., new code in view for reissue option, update lib functions to get certs by latest (MAX) timecreated).
3. The new db field will then have a new date and new code as well as the latest grade information.

Show
Chardelle Busch added a comment - I changed this to a new feature request since it is not a bug. 1. Add option to reissue the certificate. 2. Change/add code to create a new certificate_issues record each time someone clicks on a certificate that is set to "reissue" (e.g., new code in view for reissue option, update lib functions to get certs by latest (MAX) timecreated). 3. The new db field will then have a new date and new code as well as the latest grade information.
Hide
Tayla Hightower added a comment -

Where is the 'View issued certificates' option? Perhaps I'm just missing it, but if it's missing it would be a welcomed addition.

Show
Tayla Hightower added a comment - Where is the 'View issued certificates' option? Perhaps I'm just missing it, but if it's missing it would be a welcomed addition.

People

Dates

  • Created:
    Updated: