From 76ebf76be121bf9f795ea849aa1b811bd8f98e56 Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Tue, 8 Sep 2015 11:47:44 +0800 Subject: [PATCH] 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. --- mod/data/lib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mod/data/lib.php b/mod/data/lib.php index bc037e1932d..5f071b99614 100644 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -899,6 +899,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);