work on core completion

This commit is contained in:
PMKuipers 2023-06-03 00:01:43 +02:00
parent c12396f9c2
commit 2fc9c265a4
2 changed files with 11 additions and 6 deletions

View File

@ -74,6 +74,7 @@ class completionscanner
return count(self::get_course_students($this->gi->courseid));
}
// count students with ungraded (including completed-fail) worl
public function count_ungraded(){
if($this->scanner === null) {
return -1;
@ -81,7 +82,7 @@ class completionscanner
return $this->scanner->count_ungraded(self::get_course_students($this->gi->courseid));
}
public function count_graded(){
public function count_completed(){
if($this->scanner === null) {
return -1;
}
@ -100,12 +101,12 @@ class completionscanner
return $this->pending_cache[$userid];
}
public static function structure($value=VALUE_OPTIONAL){
return new \external_single_structure([
"ungraded" => new \external_value(PARAM_INT, 'number of ungraded submissions'),
"graded" => new \external_value(PARAM_INT, 'number of graded students'),
"completed" => new \external_value(PARAM_INT, 'number of completed students'),
"completed_pass" => new \external_value(PARAM_INT, 'number of completed-pass students'),
"completed_fail" => new \external_value(PARAM_INT, 'number of completed-fail students'),
"students" => new \external_value(PARAM_INT, 'number of students that should submit'),
],"details about gradable submissions",$value);
}
@ -113,7 +114,9 @@ class completionscanner
public function model(){
return [
'ungraded' => $this->count_ungraded(),
'graded' => $this->count_graded(),
'completed' => $this->count_completed(),
'completed_pass' => 0,
'completed_fail' => 0,
'students' => $this->count_students(),
];
}

View File

@ -60,7 +60,8 @@ class corecompletioninfo {
"criteria" => new \external_value(PARAM_RAW, 'criteria',VALUE_OPTIONAL),
"requirement" => new \external_value(PARAM_RAW, 'requirement',VALUE_OPTIONAL),
"status" => new \external_value(PARAM_RAW, 'status',VALUE_OPTIONAL),
]),
]),
//"studentcompletion" => completionscanner::structure(VALUE_OPTIONAL),
], 'completion type',$value);
}
@ -278,6 +279,7 @@ class corecompletioninfo {
"id" => $criteria->id,
"title" => $criteria->get_title_detailed(),
"details" => $details,
//"studentcompletion" =>
];
}