MDL-66626 assignfeedback_editpdf: Count files outside of foreach loop.
authorMikhail Golenkov <mikhailgolenkov@catalyst-au.net>
Mon, 20 Jul 2020 06:42:47 +0000 (16:42 +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/ajax.php

index fd9cd4c..432bcff 100644 (file)
@@ -125,14 +125,14 @@ if ($action === 'pollconversions') {
             $annotations = page_editor::get_annotations($grade->id, $index, $draft);
             $page->annotations = $annotations;
             $response->pages[] = $page;
-
-            $component = 'assignfeedback_editpdf';
-            $filearea = document_services::PAGE_IMAGE_FILEAREA;
-            $filepath = '/';
-            $fs = get_file_storage();
-            $files = $fs->get_directory_files($context->id, $component, $filearea, $grade->id, $filepath);
-            $response->pageready = count($files);
         }
+
+        $component = 'assignfeedback_editpdf';
+        $filearea = document_services::PAGE_IMAGE_FILEAREA;
+        $filepath = '/';
+        $fs = get_file_storage();
+        $files = $fs->get_directory_files($context->id, $component, $filearea, $grade->id, $filepath);
+        $response->pageready = count($files);
     }
 
     echo json_encode($response);