From d2e09d60d7263e3c58765f497e277bd8f5a2bb0b Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Mon, 9 Aug 2010 08:46:52 +0000 Subject: [PATCH] rating MDL-23586 made mod data delete ratings when an instance is deleted --- mod/data/lib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mod/data/lib.php b/mod/data/lib.php index 6e58fe5052c..4c14ab9d9fc 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -908,6 +908,14 @@ function data_delete_instance($id) { // takes the dataid require_once($CFG->dirroot.'/comment/lib.php'); comment::delete_comments(array('contextid'=>$context->id)); + // Delete ratings + //delete ratings + require_once($CFG->dirroot.'/rating/lib.php'); + $delopt = new stdclass(); + $delopt->contextid = $context->id; + $rm = new rating_manager(); + $rm->delete_ratings($delopt); + // get all the records in this data $sql = "SELECT r.id FROM {data_records} r