MDL-20264 work in progress on grading evaluation support

Also fixes small bugs in workshop api constructor and in using "scales"
instead of "scale" for the core table name.
This commit is contained in:
David Mudrak
2010-01-04 18:12:12 +00:00
parent 89c1aa977b
commit 8a1ba8ac04
9 changed files with 170 additions and 25 deletions
+15 -9
View File
@@ -167,16 +167,22 @@ function workshop_delete_instance($id) {
if (! $workshop = $DB->get_record('workshop', array('id' => $id))) {
return false;
}
// delete all associated aggregations
$DB->delete_records('workshop_aggregations', array('workshopid' => $workshop->id));
// get the list of ids of all submissions
$submissions = $DB->get_records('workshop_submissions', array('workshopid' => $workshop->id), '', 'id');
// get the list of all allocated assessments
$assessments = $DB->get_records_list('workshop_assessments', 'submissionid', array_keys($submissions), '', 'id');
// delete the associated records from the workshop core tables
$DB->delete_records_list('workshop_grades', 'assessmentid', array_keys($assessments));
$DB->delete_records_list('workshop_assessments', 'id', array_keys($assessments));
$DB->delete_records_list('workshop_submissions', 'id', array_keys($submissions));
// todo call the static clean-up methods of all available subplugins
// ...
// finally remove the workshop record itself
$DB->delete_records('workshop', array('id' => $workshop->id));
$result = true;
# Delete any dependent records here #
if (! $DB->delete_records('workshop', array('id' => $workshop->id))) {
$result = false;
}
return $result;
return true;
}
/**