MDL-50673 workshop: Fix the way how submissions are counted
authorDavid Mudrák <david@moodle.com>
Thu, 16 Jul 2015 17:38:48 +0000 (19:38 +0200)
committerDavid Mudrák <david@moodle.com>
Thu, 16 Jul 2015 17:41:16 +0000 (19:41 +0200)
The count_submissions() method does not take the actual enrolment into
account. It is part of the API that looks on all existing data
regardless the actual status of their owner. The author of the
submission may be unenrolled or suspended, in which case they are not
displayed in the report and we would get wrong figures.

mod/workshop/view.php

index f686bdf..b5e4211 100644 (file)
@@ -230,7 +230,7 @@ case workshop::PHASE_SUBMISSION:
         $data = $workshop->prepare_grading_report_data($USER->id, $groupid, $page, $perpage, $sortby, $sorthow);
         if ($data) {
             $countparticipants = $workshop->count_participants();
-            $countsubmissions = $workshop->count_submissions('all', $groupid);
+            $countsubmissions = $workshop->count_submissions(array_keys($data->grades), $groupid);
             $a = new stdClass();
             $a->submitted = $countsubmissions;
             $a->notsubmitted = $data->totalcount - $countsubmissions;