Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-28248 completion: Incorrect SQL for finding enrol start date

  • Loading branch information...
commit b58f4df6ea00ce9608fdf8bf9ffc0d9ecb517de4 1 parent 4f36324
Aaron Barnes authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/completion/completion_criteria_duration.php
View
7 lib/completion/completion_criteria_duration.php
@@ -90,7 +90,12 @@ public function update_config(&$data) {
private function get_timeenrolled($completion) {
global $DB;
- return $DB->get_field('user_enrolments', 'timestart', array('courseid' => $this->course, 'userid' => $completion->userid));
+ return $DB->get_field_sql('
+ SELECT eu.timestart
+ FROM {user_enrolments} eu
+ JOIN {enrol} e ON eu.enrolid = e.id
+ WHERE e.courseid = ?
+ AND eu.userid = ?', array($this->course, $completion->userid));
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.