Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit b58f4df6ea00ce9608fdf8bf9ffc0d9ecb517de4 1 parent 4f36324
Aaron Barnes authored

Showing 1 changed file with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. +6 1 lib/completion/completion_criteria_duration.php
7 lib/completion/completion_criteria_duration.php
@@ -90,7 +90,12 @@ public function update_config(&$data) {
90 90 private function get_timeenrolled($completion) {
91 91 global $DB;
92 92
93   - return $DB->get_field('user_enrolments', 'timestart', array('courseid' => $this->course, 'userid' => $completion->userid));
  93 + return $DB->get_field_sql('
  94 + SELECT eu.timestart
  95 + FROM {user_enrolments} eu
  96 + JOIN {enrol} e ON eu.enrolid = e.id
  97 + WHERE e.courseid = ?
  98 + AND eu.userid = ?', array($this->course, $completion->userid));
94 99 }
95 100
96 101 /**

0 comments on commit b58f4df

Please sign in to comment.
Something went wrong with that request. Please try again.