Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'MDL-60014-master-catcherror-nopermission-annotatepdfcro…
  • Loading branch information
David Monllao committed Jul 3, 2018
2 parents 772ae9d + 88c77c8 commit 2af5c8e
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions mod/assign/feedback/editpdf/classes/task/convert_submissions.php
Expand Up @@ -92,20 +92,18 @@ public function execute() {
}

mtrace('Convert ' . count($users) . ' submission attempt(s) for assignment ' . $assignmentid);
$keepinqueue = false;
foreach ($users as $userid) {
$combineddocument = document_services::get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber);
$status = $combineddocument->get_status();

switch ($combineddocument->get_status()) {
case combined_document::STATUS_READY:
case combined_document::STATUS_PENDING_INPUT:
// The document has not been converted yet or is somehow still ready.
$keepinqueue = true;
continue;
}

foreach ($users as $userid) {
try {
$combineddocument = document_services::get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber);
$status = $combineddocument->get_status();

switch ($combineddocument->get_status()) {
case combined_document::STATUS_READY:
case combined_document::STATUS_PENDING_INPUT:
// The document has not been converted yet or is somehow still ready.
continue;
}
document_services::get_page_images_for_attempt(
$assignment,
$userid,
Expand All @@ -120,14 +118,12 @@ public function execute() {
);
} catch (\moodle_exception $e) {
mtrace('Conversion failed with error:' . $e->errorcode);
$keepinqueue = true;
}
}

if (!$keepinqueue) {
// Remove from queue unless requested not to.
$DB->delete_records('assignfeedback_editpdf_queue', array('id' => $record->id));
}
// Remove from queue.
$DB->delete_records('assignfeedback_editpdf_queue', array('id' => $record->id));

}
}

Expand Down

0 comments on commit 2af5c8e

Please sign in to comment.