original_string: public function delete_assessment($id) {
          global $DB;
  
          if (empty($id)) {
              return true;
          }
  
          $fs = get_file_storage();
  
          if (is_array($id)) {
              $DB->delete_records_list('workshop_grades', 'assessmentid', $id);
              foreach ($id as $itemid) {
                  $fs->delete_area_files($this->context->id, 'mod_workshop', 'overallfeedback_content', $itemid);
                  $fs->delete_area_files($this->context->id, 'mod_workshop', 'overallfeedback_attachment', $itemid);
              }
              $DB->delete_records_list('workshop_assessments', 'id', $id);
  
          } else {
              $DB->delete_records('workshop_grades', array('assessmentid' => $id));
              $fs->delete_area_files($this->context->id, 'mod_workshop', 'overallfeedback_content', $id);
              $fs->delete_area_files($this->context->id, 'mod_workshop', 'overallfeedback_attachment', $id);
              $DB->delete_records('workshop_assessments', array('id' => $id));
          }
  
          return true;
      }
code: public function delete_assessment($id) {
          global $DB;
  
          if (empty($id)) {
              return true;
          }
  
          $fs = get_file_storage();
  
          if (is_array($id)) {
              $DB->delete_records_list('workshop_grades', 'assessmentid', $id);
              foreach ($id as $itemid) {
                  $fs->delete_area_files($this->context->id, 'mod_workshop', 'overallfeedback_content', $itemid);
                  $fs->delete_area_files($this->context->id, 'mod_workshop', 'overallfeedback_attachment', $itemid);
              }
              $DB->delete_records_list('workshop_assessments', 'id', $id);
  
          } else {
              $DB->delete_records('workshop_grades', array('assessmentid' => $id));
              $fs->delete_area_files($this->context->id, 'mod_workshop', 'overallfeedback_content', $id);
              $fs->delete_area_files($this->context->id, 'mod_workshop', 'overallfeedback_attachment', $id);
              $DB->delete_records('workshop_assessments', array('id' => $id));
          }
  
          return true;
      }
code_tokens: public function delete_assessment ( $ id ) { global $ DB ; if ( empty ( $ id ) ) { return true ; } $ fs = get_file_storage ( ) ; if ( is_array ( $ id ) ) { $ DB -> delete_records_list ( 'workshop_grades' , 'assessmentid' , $ id ) ; foreach ( $ id as $ itemid ) { $ fs -> delete_area_files ( $ this -> context -> id , 'mod_workshop' , 'overallfeedback_content' , $ itemid ) ; $ fs -> delete_area_files ( $ this -> context -> id , 'mod_workshop' , 'overallfeedback_attachment' , $ itemid ) ; } $ DB -> delete_records_list ( 'workshop_assessments' , 'id' , $ id ) ; } else { $ DB -> delete_records ( 'workshop_grades' , array ( 'assessmentid' => $ id ) ) ; $ fs -> delete_area_files ( $ this -> context -> id , 'mod_workshop' , 'overallfeedback_content' , $ id ) ; $ fs -> delete_area_files ( $ this -> context -> id , 'mod_workshop' , 'overallfeedback_attachment' , $ id ) ; $ DB -> delete_records ( 'workshop_assessments' , array ( 'id' => $ id ) ) ; } return true ; }
docstring: Delete assessment record or records.
  
  Removes associated records from the workshop_grades table, too.
  
  @param int|array $id assessment id or array of assessments ids
  @todo Give grading strategy plugins a chance to clean up their data, too.
  @return bool true
docstring_tokens: Delete assessment record or records .