Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
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.
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.