* Obtains a list of activities for which completion is enabled on the
* course. The list is ordered by the section order of those activities.
*
- * @return array Array from $cmid => $cm of all activities with completion enabled,
+ * @return cm_info[] Array from $cmid => $cm of all activities with completion enabled,
* empty array if none
*/
public function get_activities() {
context_course::instance($this->course->id),
'moodle/course:isincompletionreports', $groupid, true);
- $sql = 'SELECT u.id, u.firstname, u.lastname, u.idnumber';
+ $allusernames = get_all_user_name_fields(true, 'u');
+ $sql = 'SELECT u.id, u.idnumber, ' . $allusernames;
if ($extracontext) {
$sql .= get_extra_user_fields_sql($extracontext, 'u', '', array('idnumber'));
}
* @return int Completion state e.g. COMPLETION_INCOMPLETE
*/
public static function internal_get_grade_state($item, $grade) {
- if (!$grade) {
+ // If no grade is supplied or the grade doesn't have an actual value, then
+ // this is not complete.
+ if (!$grade || (is_null($grade->finalgrade) && is_null($grade->rawgrade))) {
return COMPLETION_INCOMPLETE;
}
+
// Conditions to show pass/fail:
// a) Grade has pass mark (default is 0.00000 which is boolean true so be careful)
// b) Grade is visible (neither hidden nor hidden-until)