MDL-71471 assign: Remove submission from queue when converted in web
This commit is contained in:
@@ -82,9 +82,21 @@ if ($action === 'pollconversions') {
|
||||
$completestatuslist = [combined_document::STATUS_COMPLETE, combined_document::STATUS_FAILED];
|
||||
|
||||
if (in_array($response->status, $readystatuslist)) {
|
||||
// It seems that the files for this submission haven't been combined by the
|
||||
// "\assignfeedback_editpdf\task\convert_submissions" scheduled task.
|
||||
// Try to combine them in the user session.
|
||||
$combineddocument = document_services::get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber);
|
||||
$response->status = $combineddocument->get_status();
|
||||
$response->filecount = $combineddocument->get_document_count();
|
||||
|
||||
// Check status of the combined document and remove the submission
|
||||
// from the task queue if combination completed.
|
||||
if (in_array($response->status, $completestatuslist)) {
|
||||
$submission = $assignment->get_user_submission($userid, false, $attemptnumber);
|
||||
if ($submission) {
|
||||
$DB->delete_records('assignfeedback_editpdf_queue', array('submissionid' => $submission->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($response->status, $completestatuslist)) {
|
||||
|
||||
@@ -113,5 +113,23 @@ function xmldb_assignfeedback_editpdf_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.10.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2020110901) {
|
||||
// Remove submissions from the processing queue that have been processed.
|
||||
$sql = 'DELETE
|
||||
FROM {assignfeedback_editpdf_queue}
|
||||
WHERE EXISTS (SELECT 1
|
||||
FROM {assign_submission} s,
|
||||
{assign_grades} g
|
||||
WHERE s.id = submissionid
|
||||
AND s.assignment = g.assignment
|
||||
AND s.userid = g.userid
|
||||
AND s.attemptnumber = g.attemptnumber)';
|
||||
|
||||
$DB->execute($sql);
|
||||
|
||||
// Editpdf savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2020110901, 'assignfeedback', 'editpdf');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2020110900;
|
||||
$plugin->version = 2020110901;
|
||||
$plugin->requires = 2020110300;
|
||||
$plugin->component = 'assignfeedback_editpdf';
|
||||
|
||||
Reference in New Issue
Block a user