From 4c2a2bd7ce86dbdd02624fc13d814e334e5f3883 Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Wed, 4 Oct 2017 13:09:59 +0200 Subject: [PATCH] MDL-59241 mod_workshop: Fix testing found issues - totalfilesize counting all submissions - Improved function documentation --- mod/workshop/classes/external.php | 8 +++++--- mod/workshop/db/services.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mod/workshop/classes/external.php b/mod/workshop/classes/external.php index 56bf244ee3f..773fb0b5a8f 100644 --- a/mod/workshop/classes/external.php +++ b/mod/workshop/classes/external.php @@ -782,7 +782,8 @@ class mod_workshop_external extends external_api { } /** - * Retrieves all the workshop submissions visible by the current user or the one done by the given user. + * Retrieves all the workshop submissions visible by the current user or the one done by the given user + * (except example submissions). * * @param int $workshopid the workshop instance id * @param int $userid get submissions done by this user @@ -847,7 +848,7 @@ class mod_workshop_external extends external_api { $fs = get_file_storage(); $files = $fs->get_area_files($context->id, 'mod_workshop', array('submission_content', 'submission_attachment')); foreach ($files as $file) { - if ($file->is_directory() || !isset($submissionsrecords[$file->get_itemid()])) { + if ($file->is_directory()) { continue; } $totalfilesize += $file->get_filesize(); @@ -874,7 +875,8 @@ class mod_workshop_external extends external_api { submission_exporter::get_read_structure() ), 'totalcount' => new external_value(PARAM_INT, 'Total count of submissions.'), - 'totalfilesize' => new external_value(PARAM_INT, 'Total size (bytes) of the files included in the submissions.'), + 'totalfilesize' => new external_value(PARAM_INT, 'Total size (bytes) of the files attached to all the + submissions (even the ones not returned due to pagination).'), 'warnings' => new external_warnings() ) ); diff --git a/mod/workshop/db/services.php b/mod/workshop/db/services.php index bbe4a90babf..c17640aaacd 100644 --- a/mod/workshop/db/services.php +++ b/mod/workshop/db/services.php @@ -88,7 +88,7 @@ $functions = array( 'mod_workshop_get_submissions' => array( 'classname' => 'mod_workshop_external', 'methodname' => 'get_submissions', - 'description' => 'Retrieves all the workshop submissions or the one done by the given user.', + 'description' => 'Retrieves all the workshop submissions or the one done by the given user (except example submissions).', 'type' => 'read', 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE) ), -- 2.43.0