From 42f75f5a52c7a91cae7401c8dffd76c3f78beb13 Mon Sep 17 00:00:00 2001 From: Mikhail Golenkov Date: Mon, 20 Jul 2020 16:45:13 +1000 Subject: [PATCH] MDL-66626 assignfeedback_editpdf: Check page count for attempt. Co-Authored-By: John Yao --- mod/assign/feedback/editpdf/classes/document_services.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mod/assign/feedback/editpdf/classes/document_services.php b/mod/assign/feedback/editpdf/classes/document_services.php index 9c02a10cb51..f417141596a 100644 --- a/mod/assign/feedback/editpdf/classes/document_services.php +++ b/mod/assign/feedback/editpdf/classes/document_services.php @@ -576,7 +576,9 @@ EOD; } } - if (empty($pages)) { + $totalpagesforattempt = self::page_number_for_attempt($assignment, $userid, $attemptnumber, false); + // Here we are comparing the total number of images against the total number of pages from the combined PDF. + if (empty($pages) || count($pages) != $totalpagesforattempt) { if ($readonly) { // This should never happen, there should be a version of the pages available // whenever we are requesting the readonly version.