Merge branch 'MDL-65886-MOODLE-master' of https://github.com/kristian-94/moodle
authorAdrian Greeve <abgreeve@gmail.com>
Mon, 19 Aug 2019 06:12:36 +0000 (14:12 +0800)
committerAdrian Greeve <abgreeve@gmail.com>
Mon, 19 Aug 2019 06:13:45 +0000 (14:13 +0800)
1  2 
mod/assign/submission/file/locallib.php

@@@ -314,12 -314,18 +314,18 @@@ class assign_submission_file extends as
       * @return boolean
       */
      public function remove(stdClass $submission) {
++        global $DB;
          $fs = get_file_storage();
  
          $fs->delete_area_files($this->assignment->get_context()->id,
                                 'assignsubmission_file',
                                 ASSIGNSUBMISSION_FILE_FILEAREA,
                                 $submission->id);
 -        global $DB;
+         $currentsubmission = $this->get_file_submission($submission->id);
+         $currentsubmission->numfiles = 0;
+         $DB->update_record('assignsubmission_file', $currentsubmission);
          return true;
      }