we are having a problem with our system's Course Certificate.
We have set the course certificate to display the grade from the last quiz attempt if passed (if a grade above 80% is achieved)
However, whilst the course certificate is only available if a grade from the last quiz attempt was over 80%, the grade printed on the certificate remains the same one from a previous attempt.
i.e. We attempted the quiz 5 time today, the following were the times/results
No matter what we try, the certificate only displays the 3pm score (90%) when available.
Any help or suggestions would be most welcome as we are struggling to understand what is causing this problem.
I have exactly the same problem, and would love a little assistance on this.
we still havn't solved this problem.
Essentially, we're looking to print a certificate with the grade of the last attempt.
However, we can only view the first attempt.
Any help would be most welcome, thanks
This is the cause of the problem:
When your 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
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?
I haven't figured it out yet so I loaded an issue on the Tracker: