UNIMOODLE / moodle-mod_certifygen

GNU General Public License v3.0
1 stars 1 forks source link

Scheduled tasks and status unnecesary delay #84

Open juacas opened 4 days ago

juacas commented 4 days ago

The plugin defines 3 scheduled tasks:

$tasks = [
    [
        'classname' => 'mod_certifygen\task\checkstatus',
        'blocking' => 0,
        'minute' => '0',
        'hour' => '*',
        'day' => '*',
        'month' => '*',
        'dayofweek' => '*',
    ],
    [
        'classname' => 'mod_certifygen\task\checkfile',
        'blocking' => 0,
        'minute' => '0',
        'hour' => '*',
        'day' => '*',
        'month' => '*',
        'dayofweek' => '*',
    ],
    [
        'classname' => 'mod_certifygen\task\checkerror',
        'blocking' => 0,
        'minute' => '0',
        'hour' => '1',
        'day' => '*',
        'month' => '*',
        'dayofweek' => '*',
    ],
];

Problem 1: DOCUMENTATION. They are undocumented. What is each task for? What functionality implements? Please briefliy document the classes.

Problem 2: DELAY. Checkstatus seems to be the responsible for going from one state to the next (request->validation->file management->issued). Running it each hour is not acceptable because it generates delays of one hour with tasks that may be executed in seconds. Example: Sending PDF to a certification system (i.e. CSV) that responds in 5 seconds force the user to wait an hour. Declare 'minute' => '*' in cron definition,

Problem 3: User doesn't have any clue about when the certification is ready. A notification at the end of the process is needed.

Problem 4: Certifygen doesn't have any task like "\mod_coursecertificate\task\issue_certificates_task" that can emit certificates when conditions are meet for the students. This functionality is in the specification as:

El plugin ofrecerá las siguientes formas de entregar el certificado al usuario: • Como actividad en el curso para el alumno donde al cumplirse los criterios para activarse se inicie la generación del certificado y >muestre al alumno el estado de la generación y los enlaces de descarga del documento definitivo.

elena3ip commented 4 days ago

Problem 1: The tasks are documented in the readme file

Problem 2: By default, we assume that no time interval should be set that could negatively impact the platform's performance. An administrator can modify how often a task should be executed.

Problem 3: The statuses already indicate the progress of the process. What additional type of notification are you referring to?

Problem 4: What is outlined in that requirement already occurs as described: the user selects a language, and upon clicking the issue certificate button, the process begins. There are two tasks responsible for validation and storage, after which the user can download the certificate. Please let us know why there is a need for a scheduled task to perform this process.

juacas commented 4 days ago

1) Great! Please copy them into the PHPDOC, when you can. 2) Please set it to 'minute' => '*' by default, 3) Please add a call to notification API when a request reaches the status of readiness. Just like in: https://github.com/moodleworkplace/moodle-tool_certificate/blob/c2e02ccb38e9d4632f6c2dca2053a56b6bad1583/classes/template.php#L733 4) It means that Course Certificates be automatically generated when an user meets the criteria. This is how mod_coursecertificate can work and it's a very convenient feature. That's the sense of the wording "al cumplirse los criterios para activarse se inicie la generación del certificado". That is, the criteria triggers the generation, not only the manual pressing of a button (which also does it). Does the current architecture supports to launch the request process from a scheduledtask like \mod_coursecertificate\task\issue_certificates_task ?

juacas commented 4 days ago

Related to "could negatively impact the platform's performance" Has the use of AdHocTasks been considered for processing state steps? The Adhoc method allows tasks to be distributed into smaller units. Maybe its too late for this.

elena3ip commented 2 days ago

I have uploaded sending notifications when certificate is ready to github repository