Optimizing Email Delivery Time for mod_customcert Certificate Task in Moodle

Re: Optimizing Email Delivery Time for mod_customcert Certificate Task in Moodle

by Mohamed Atia -
Number of replies: 0

Hi Mike,

I wanted to update you on the progress I've made in response to our recent discussion. After setting up a Moodle development environment and familiarizing myself with Moodle and the email task within your plugin, I've implemented the following changes:

Scheduled Task Configuration:

  • Added a new settings header "Scheduled Task Configuration."
  • Introduced three new settings: 
    • a. Certificates Per Run: Enter the number of certificates to process per scheduled task run (0 for all certificates). 
    • b. Include Certificates in Not Visible Courses: Checkbox to include certificates in courses not visible to the user. (in our production site there are1000+ certificates in hidden courses)
    • c. Certificate Execution Period: Specify the period for certificate execution based on their end date (0 for all certificates).


Database Table for Tracking:

  • Added a new table in the database to track the current position of the certificate to be processed.
    for some reason when I updated the plugin default data was not created so I created it using the below query after upgrade, I will troubleshoot this later

    INSERT INTO customcert_task_progress (taskname, last_processed, total_certificate_to_process, usermodified, timecreated, timemodified)
    VALUES ('email_certificate_task', 0, 0, 2, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());

I updated the emailed value for all users in a single query per certificate to minimize database write queries.

Future Enhancements:

  1. Considering an option in settings to send the certificate URL instead of the PDF (I will work on it).
  2. Exploring the possibility of dividing the task into two separate tasks: one for issuing certificates and one for email.
  3. Investigating techniques for running the certificate issuing task in parallel for improved efficiency.

You can access my changes at this fork from your plugin: https://github.com/mohamedmohamedatia/moodle-mod_customcert.git

I'm excited about these developments and would appreciate your feedback.