From: Adrian Greeve Date: Tue, 8 Sep 2015 03:47:44 +0000 (+0800) Subject: MDL-51259 mod_data: ratings of items not activated. X-Git-Tag: v3.0.0-beta~219^2 X-Git-Url: http://git.moodle.org/gw?p=moodle.git;a=commitdiff_plain;h=f3013ba67e60583a15d5a01ac4db33b2e1b1c176 MDL-51259 mod_data: ratings of items not activated. When selecting a rating method, the restrict rating to items with dates would be automatically enabled if not checked. This code brings the data module inline with forum and glossary. --- diff --git a/mod/data/lib.php b/mod/data/lib.php index d6641073566..82b5dc24fb3 100644 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -910,6 +910,11 @@ function data_add_instance($data, $mform = null) { $data->assessed = 0; } + if (empty($data->ratingtime) || empty($data->assessed)) { + $data->assesstimestart = 0; + $data->assesstimefinish = 0; + } + $data->timemodified = time(); $data->id = $DB->insert_record('data', $data);