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?