mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
Merge branch 'MDL-58860-master' of git://github.com/jleyva/moodle
This commit is contained in:
commit
834da9a30f
@ -1681,7 +1681,7 @@ class mod_lesson_external extends external_api {
|
||||
|
||||
$params = array('lessonid' => $lessonid, 'groupid' => $groupid);
|
||||
$params = self::validate_parameters(self::get_attempts_overview_parameters(), $params);
|
||||
$studentsdata = $warnings = array();
|
||||
$warnings = array();
|
||||
|
||||
list($lesson, $course, $cm, $context, $lessonrecord) = self::validate_lesson($params['lessonid']);
|
||||
require_capability('mod/lesson:viewreports', $context);
|
||||
@ -1705,15 +1705,15 @@ class mod_lesson_external extends external_api {
|
||||
}
|
||||
}
|
||||
|
||||
list($table, $data) = lesson_get_overview_report_table_and_data($lesson, $groupid);
|
||||
if ($data !== false) {
|
||||
$studentsdata = $data;
|
||||
}
|
||||
|
||||
$result = array(
|
||||
'data' => $studentsdata,
|
||||
'warnings' => $warnings
|
||||
);
|
||||
|
||||
list($table, $data) = lesson_get_overview_report_table_and_data($lesson, $groupid);
|
||||
if ($data !== false) {
|
||||
$result['data'] = $data;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -1756,7 +1756,8 @@ class mod_lesson_external extends external_api {
|
||||
)
|
||||
), 'Students data, including attempts.', VALUE_OPTIONAL
|
||||
),
|
||||
)
|
||||
),
|
||||
'Attempts overview data (empty for no attemps).', VALUE_OPTIONAL
|
||||
),
|
||||
'warnings' => new external_warnings(),
|
||||
)
|
||||
|
@ -1181,6 +1181,17 @@ class mod_lesson_external_testcase extends externallib_advanced_testcase {
|
||||
$this->assertCount(2, $result['data']['students']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get_attempts_overview when there aren't attempts.
|
||||
*/
|
||||
public function test_get_attempts_overview_no_attempts() {
|
||||
$this->setAdminUser();
|
||||
$result = mod_lesson_external::get_attempts_overview($this->lesson->id);
|
||||
$result = external_api::clean_returnvalue(mod_lesson_external::get_attempts_overview_returns(), $result);
|
||||
$this->assertCount(0, $result['warnings']);
|
||||
$this->assertArrayNotHasKey('data', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get_user_attempt
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user