MDL-66626 assignfeedback_editpdf: Check page count for attempt.
authorMikhail Golenkov <mikhailgolenkov@catalyst-au.net>
Mon, 20 Jul 2020 06:45:13 +0000 (16:45 +1000)
committerMikhail Golenkov <mikhailgolenkov@catalyst-au.net>
Sun, 26 Jul 2020 23:49:56 +0000 (09:49 +1000)
Co-Authored-By: John Yao <johnyao@catalyst-au.net>
mod/assign/feedback/editpdf/classes/document_services.php

index 9c02a10..f417141 100644 (file)
@@ -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.