mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
Merge branch 'MDL-66241_master' of git://github.com/dmonllao/moodle
This commit is contained in:
commit
74a9ee3277
@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/test_target_shortname.php');
|
||||
require_once(__DIR__ . '/test_target_site_users.php');
|
||||
|
||||
/**
|
||||
* Test target.
|
||||
|
@ -68,8 +68,10 @@ class activities_due extends \core_analytics\local\indicator\binary {
|
||||
*/
|
||||
protected function calculate_sample($sampleid, $sampleorigin, $starttime = false, $endtime = false) {
|
||||
|
||||
$user = $this->retrieve('user', $sampleid);
|
||||
|
||||
$actionevents = \core_calendar_external::get_calendar_action_events_by_timesort($starttime, $endtime, 0, 1,
|
||||
true, $sampleid);
|
||||
true, $user->id);
|
||||
|
||||
if ($actionevents->events) {
|
||||
|
||||
|
@ -28,6 +28,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
require_once(__DIR__ . '/../../lib/completionlib.php');
|
||||
require_once(__DIR__ . '/../../completion/criteria/completion_criteria_self.php');
|
||||
require_once(__DIR__ . '/../../analytics/tests/fixtures/test_target_course_users.php');
|
||||
|
||||
/**
|
||||
* Unit tests for core_course indicators.
|
||||
@ -313,4 +314,30 @@ class core_course_indicators_testcase extends advanced_testcase {
|
||||
// Page social is level 1 (the lower level).
|
||||
$this->assertEquals($indicator::get_min_value(), $values[$cm2->id][0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* test_activities_due
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_activities_due() {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminuser();
|
||||
|
||||
$course1 = $this->getDataGenerator()->create_course();
|
||||
$user1 = $this->getDataGenerator()->create_user();
|
||||
$this->getDataGenerator()->enrol_user($user1->id, $course1->id, 'student');
|
||||
|
||||
$target = \core_analytics\manager::get_target('test_target_course_users');
|
||||
$indicators = array('\core_course\analytics\indicator\activities_due');
|
||||
foreach ($indicators as $key => $indicator) {
|
||||
$indicators[$key] = \core_analytics\manager::get_indicator($indicator);
|
||||
}
|
||||
|
||||
$model = \core_analytics\model::create($target, $indicators);
|
||||
$model->enable('\core\analytics\time_splitting\single_range');
|
||||
$model->train();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user