When a student completes a course, something happens in the database that makes their certificate available. What is it?

When a student completes a course, something happens in the database that makes their certificate available. What is it?

by The Bard In Green -
Number of replies: 1

I imagine it's some context value.  Or combination of a course completion and a context value or something like that.

I have a bash script (I know, I know!)  that takes incomplete CSVs of a student's quiz attempt from an old installation of moodle and does it's best to recreate a new quiz attempt, making educated guesses about the student's original responses.  These quizes are the ONLY course activity required for a student to complete a course, receive a grade and download a certificate from the certificate module.  

There's a whole story there that involves one of my clients being in litigation with their former web host, me being a DBA and linux admin with NO moodle experience at ALL, but who has built educational databases and applications before.

Anyway, I've gotten my script working, except that the certificates are hidden from students, so clearly I'm not correctly marking the courses as completed or something.  As an admin, I'm able to view and download a certificate for an imported student, but when logged in as a student, Moodle says "this activity is hidden" when I try to download the certificate.

The whole point of doing this is so that students can download copies of certificates they were issued in 2012 or earlier (some of the quiz attempts are from as long ago as 2004) with correct dates and score totals on them.  I'm at that point except for the certificates not being available.

What do I need to write into the database to make that happen?

Average of ratings: -
In reply to The Bard In Green

Re: When a student completes a course, something happens in the database that makes their certificate available. What is it?

by Anne Krijger -

Hi Green One,

To see what happens in the DB do a DB dump before and after and compare the files.

mysqldump -v -u root -p --no-create-info --skip-lock-tab
--result-file=moodle_dump.sql moodle_db

My guess is though you should be looking at calling some Moodle (API) code instead of just updating the database.

Anne.
[No real experience with certificates]