MDL-56307 course: Return time updated and times updated

This commit is contained in:
Juan Leyva 2016-10-20 20:08:32 +01:00
parent cebce76f61
commit 65b2669d98
13 changed files with 146 additions and 63 deletions

View file

@ -1069,8 +1069,13 @@ function survey_check_updates_since(cm_info $cm, $from, $filter = array()) {
}
$updates = course_check_module_updates_since($cm, $from, array(), $filter);
$updates->answers = (object) array('updated' => false);
$select = 'survey = ? AND userid = ? AND time > ?';
$params = array($cm->instance, $USER->id, $from);
$updates->tracks = $DB->count_records_select('survey_answers', $select, $params) > 0;
$answers = $DB->get_records_select('survey_answers', $select, $params, '', 'id');
if (!empty($answers)) {
$updates->answers->updated = true;
$updates->answers->itemids = array_keys($answers);
}
return $updates;
}