Merge branch 'MDL-65248_master' of git://github.com/dmonllao/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2019-04-23 13:50:22 +02:00
commit 0d575a542a
19 changed files with 137 additions and 108 deletions

View File

@ -204,9 +204,9 @@ function tool_analytics_calculate_course_dates($course, $options) {
$updateit = false;
if ($course->enddate < $course->startdate) {
$notification .= PHP_EOL . ' ' . get_string('errorendbeforestart', 'analytics', userdate($course->enddate));
$notification .= PHP_EOL . ' ' . get_string('errorendbeforestart', 'course', userdate($course->enddate));
} else if ($course->startdate + (YEARSECS + (WEEKSECS * 4)) > $course->enddate) {
$notification .= PHP_EOL . ' ' . get_string('coursetoolong', 'analytics');
$notification .= PHP_EOL . ' ' . get_string('coursetoolong', 'course');
} else {
$notification .= PHP_EOL . ' ' . get_string('enddate') . ': ' . userdate($course->enddate);
$updateit = true;

View File

@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die();
$models = [
[
'target' => '\core\analytics\target\no_teaching',
'target' => '\core_course\analytics\target\no_teaching',
'indicators' => [
'\core_course\analytics\indicator\no_teacher',
'\core_course\analytics\indicator\no_student',

View File

@ -360,8 +360,8 @@ class analytics_manager_testcase extends advanced_testcase {
$this->resetAfterTest();
$this->setAdminuser();
$noteaching = \core_analytics\manager::get_target('\core\analytics\target\no_teaching');
$dropout = \core_analytics\manager::get_target('\core\analytics\target\course_dropout');
$noteaching = \core_analytics\manager::get_target('\core_course\analytics\target\no_teaching');
$dropout = \core_analytics\manager::get_target('\core_course\analytics\target\course_dropout');
$upcomingactivities = \core_analytics\manager::get_target('\core_user\analytics\target\upcoming_activities_due');
$this->assertTrue(\core_analytics\model::exists($noteaching));

View File

@ -71,7 +71,7 @@ class analytics_model_testcase extends advanced_testcase {
public function test_create() {
$this->resetAfterTest(true);
$target = \core_analytics\manager::get_target('\core\analytics\target\course_dropout');
$target = \core_analytics\manager::get_target('\core_course\analytics\target\course_dropout');
$indicators = array(
\core_analytics\manager::get_indicator('\core\analytics\indicator\any_write_action'),
\core_analytics\manager::get_indicator('\core\analytics\indicator\read_actions')
@ -272,7 +272,7 @@ class analytics_model_testcase extends advanced_testcase {
public function test_exists() {
$this->resetAfterTest(true);
$target = \core_analytics\manager::get_target('\core\analytics\target\no_teaching');
$target = \core_analytics\manager::get_target('\core_course\analytics\target\no_teaching');
$this->assertTrue(\core_analytics\model::exists($target));
foreach (\core_analytics\manager::get_all_models() as $model) {

View File

@ -51,11 +51,11 @@ class analytics_stats_testcase extends advanced_testcase {
$this->resetAfterTest(true);
// By default, sites have {@link \core\analytics\target\no_teaching} enabled.
// By default, sites have {@link \core_course\analytics\target\no_teaching} enabled.
$this->assertEquals(1, \core_analytics\stats::enabled_models());
$model = \core_analytics\model::create(
\core_analytics\manager::get_target('\core\analytics\target\course_dropout'),
\core_analytics\manager::get_target('\core_course\analytics\target\course_dropout'),
[
\core_analytics\manager::get_indicator('\core\analytics\indicator\any_write_action'),
]

View File

@ -17,23 +17,23 @@
/**
* Course competencies achievement target.
*
* @package core
* @package core_course
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\analytics\target;
namespace core_course\analytics\target;
defined('MOODLE_INTERNAL') || die();
/**
* Course competencies achievement target.
*
* @package core
* @package core_course
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_competencies extends \core\analytics\target\course_enrolments {
class course_competencies extends course_enrolments {
/**
* Number of competencies assigned per course.
@ -69,7 +69,7 @@ class course_competencies extends \core\analytics\target\course_enrolments {
* @return \lang_string
*/
public static function get_name() : \lang_string {
return new \lang_string('target:coursecompetencies');
return new \lang_string('target:coursecompetencies', 'course');
}
/**
@ -79,8 +79,8 @@ class course_competencies extends \core\analytics\target\course_enrolments {
*/
protected static function classes_description() {
return array(
get_string('targetlabelstudentcompetenciesno'),
get_string('targetlabelstudentcompetenciesyes'),
get_string('targetlabelstudentcompetenciesno', 'course'),
get_string('targetlabelstudentcompetenciesyes', 'course'),
);
}

View File

@ -17,12 +17,12 @@
/**
* Course completion target.
*
* @package core
* @package core_course
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\analytics\target;
namespace core_course\analytics\target;
defined('MOODLE_INTERNAL') || die();
@ -33,11 +33,11 @@ require_once($CFG->dirroot . '/completion/completion_completion.php');
/**
* Course completion target.
*
* @package core
* @package core_course
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_completion extends \core\analytics\target\course_enrolments {
class course_completion extends course_enrolments {
/**
* Returns the name.
@ -47,7 +47,7 @@ class course_completion extends \core\analytics\target\course_enrolments {
* @return \lang_string
*/
public static function get_name() : \lang_string {
return new \lang_string('target:coursecompletion');
return new \lang_string('target:coursecompletion', 'course');
}
/**
@ -57,8 +57,8 @@ class course_completion extends \core\analytics\target\course_enrolments {
*/
protected static function classes_description() {
return array(
get_string('targetlabelstudentcompletionno'),
get_string('targetlabelstudentcompletionyes')
get_string('targetlabelstudentcompletionno', 'course'),
get_string('targetlabelstudentcompletionyes', 'course')
);
}

View File

@ -17,12 +17,12 @@
/**
* Drop out course target.
*
* @package core
* @package core_course
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\analytics\target;
namespace core_course\analytics\target;
defined('MOODLE_INTERNAL') || die();
@ -34,11 +34,11 @@ require_once($CFG->dirroot . '/completion/completion_completion.php');
/**
* Drop out course target.
*
* @package core
* @package core_course
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_dropout extends \core\analytics\target\course_enrolments {
class course_dropout extends course_enrolments {
/**
* Returns the name.
@ -48,7 +48,7 @@ class course_dropout extends \core\analytics\target\course_enrolments {
* @return \lang_string
*/
public static function get_name() : \lang_string {
return new \lang_string('target:coursedropout');
return new \lang_string('target:coursedropout', 'course');
}
/**
@ -58,8 +58,8 @@ class course_dropout extends \core\analytics\target\course_enrolments {
*/
protected static function classes_description() {
return array(
get_string('targetlabelstudentdropoutno'),
get_string('targetlabelstudentdropoutyes')
get_string('targetlabelstudentdropoutno', 'course'),
get_string('targetlabelstudentdropoutyes', 'course')
);
}
@ -96,7 +96,7 @@ class course_dropout extends \core\analytics\target\course_enrolments {
// At least a minimum of students activity.
$nstudents = count($this->students);
if ($nlogs / $nstudents < 10) {
return get_string('nocourseactivity');
return get_string('nocourseactivity', 'course');
}
}

View File

@ -17,19 +17,19 @@
/**
* Base class for targets whose analysable is a course using user enrolments as samples.
*
* @package core
* @package core_course
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\analytics\target;
namespace core_course\analytics\target;
defined('MOODLE_INTERNAL') || die();
/**
* Base class for targets whose analysable is a course using user enrolments as samples.
*
* @package core
* @package core_course
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -58,7 +58,7 @@ abstract class course_enrolments extends \core_analytics\local\target\binary {
* @return string
*/
public function get_insight_subject(int $modelid, \context $context) {
return get_string('studentsatriskincourse', 'moodle', $context->get_context_name(false));
return get_string('studentsatriskincourse', 'course', $context->get_context_name(false));
}
/**
@ -71,41 +71,41 @@ abstract class course_enrolments extends \core_analytics\local\target\binary {
public function is_valid_analysable(\core_analytics\analysable $course, $fortraining = true) {
if (!$course->was_started()) {
return get_string('coursenotyetstarted');
return get_string('coursenotyetstarted', 'course');
}
if (!$this->students = $course->get_students()) {
return get_string('nocoursestudents');
return get_string('nocoursestudents', 'course');
}
if (!course_format_uses_sections($course->get_course_data()->format)) {
// We can not split activities in time ranges.
return get_string('nocoursesections');
return get_string('nocoursesections', 'course');
}
if ($course->get_end() == 0) {
// We require time end to be set.
return get_string('nocourseendtime');
return get_string('nocourseendtime', 'course');
}
if ($course->get_end() < $course->get_start()) {
return get_string('errorendbeforestart', 'analytics');
return get_string('errorendbeforestart', 'course');
}
// A course that lasts longer than 1 year probably have wrong start or end dates.
if ($course->get_end() - $course->get_start() > (YEARSECS + (WEEKSECS * 4))) {
return get_string('coursetoolong', 'analytics');
return get_string('coursetoolong', 'course');
}
// Finished courses can not be used to get predictions.
if (!$fortraining && $course->is_finished()) {
return get_string('coursealreadyfinished');
return get_string('coursealreadyfinished', 'course');
}
if ($fortraining) {
// Ongoing courses data can not be used to train.
if (!$course->is_finished()) {
return get_string('coursenotyetfinished');
return get_string('coursenotyetfinished', 'course');
}
}

View File

@ -17,12 +17,12 @@
/**
* Getting the minimum grade to pass target.
*
* @package core
* @package core_course
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\analytics\target;
namespace core_course\analytics\target;
defined('MOODLE_INTERNAL') || die();
@ -30,11 +30,11 @@ defined('MOODLE_INTERNAL') || die();
/**
* Getting the minimum grade to pass target.
*
* @package core
* @package core_course
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_gradetopass extends \core\analytics\target\course_enrolments {
class course_gradetopass extends course_enrolments {
/**
* Courses grades to pass.
@ -114,7 +114,7 @@ class course_gradetopass extends \core\analytics\target\course_enrolments {
* @return \lang_string
*/
public static function get_name() : \lang_string {
return new \lang_string('target:coursegradetopass');
return new \lang_string('target:coursegradetopass', 'course');
}
/**
@ -124,8 +124,8 @@ class course_gradetopass extends \core\analytics\target\course_enrolments {
*/
protected static function classes_description() {
return array(
get_string('targetlabelstudentgradetopassno'),
get_string('targetlabelstudentgradetopassyes')
get_string('targetlabelstudentgradetopassno', 'course'),
get_string('targetlabelstudentgradetopassyes', 'course')
);
}

View File

@ -17,19 +17,19 @@
/**
* No teaching target.
*
* @package core
* @package core_course
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\analytics\target;
namespace core_course\analytics\target;
defined('MOODLE_INTERNAL') || die();
/**
* No teaching target.
*
* @package core
* @package core_course
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -52,7 +52,7 @@ class no_teaching extends \core_analytics\local\target\binary {
* @return \lang_string
*/
public static function get_name() : \lang_string {
return new \lang_string('target:noteachingactivity');
return new \lang_string('target:noteachingactivity', 'course');
}
/**
@ -111,8 +111,8 @@ class no_teaching extends \core_analytics\local\target\binary {
*/
protected static function classes_description() {
return array(
get_string('targetlabelteachingyes'),
get_string('targetlabelteachingno'),
get_string('targetlabelteachingyes', 'course'),
get_string('targetlabelteachingno', 'course'),
);
}

View File

@ -29,7 +29,6 @@ $string['analytics'] = 'Analytics';
$string['analyticslogstore'] = 'Log store used for analytics';
$string['analyticslogstore_help'] = 'The log store that will be used by the analytics API to read users\' activity';
$string['analyticssettings'] = 'Analytics settings';
$string['coursetoolong'] = 'The course is too long';
$string['defaulttimesplittingmethods'] = 'Default time-splitting methods for model\'s evaluation';
$string['defaulttimesplittingmethods_help'] = 'The time-splitting method divides the course duration into parts; the predictions engine will run at the end of these parts. The model evaluation process will iterate through these time-splitting methods unless a specific time-splitting method is specified (the ability to specify a time-splitting method is only available when evaluating models using the command line script).';
$string['defaultpredictionsprocessor'] = 'Default predictions processor';
@ -38,7 +37,6 @@ $string['disabledmodel'] = 'Disabled model';
$string['erroralreadypredict'] = 'File {$a} has already been used to generate predictions.';
$string['errorcannotreaddataset'] = 'Dataset file {$a} can not be read';
$string['errorcannotwritedataset'] = 'Dataset file {$a} cannot be written';
$string['errorendbeforestart'] = 'The end date ({$a}) is before the course start date.';
$string['errorexportmodelresult'] = 'The machine learning model can not be exported.';
$string['errorimport'] = 'Error importing the provided json file.';
$string['errorimportmissingcomponents'] = 'The provided model requires the following plugins to be installed: {$a}. Note that the versions do not necessarily need to match with the versions installed in your system. To install the same or a newer version of the plugin should be enough in most cases.';

View File

@ -27,6 +27,10 @@ $string['aria:courseimage'] = 'Course image';
$string['aria:courseshortname'] = 'Course short name';
$string['aria:coursename'] = 'Course name';
$string['aria:favourite'] = 'Course is starred';
$string['coursealreadyfinished'] = 'Course already finished';
$string['coursenotyetstarted'] = 'The course has not yet started';
$string['coursenotyetfinished'] = 'The course has not yet finished';
$string['coursetoolong'] = 'The course is too long';
$string['customfield_islocked'] = 'Locked';
$string['customfield_islocked_help'] = 'If the field is locked, only users with the capability to change locked custom fields (by default users with the default role of manager only) will be able to change it in the course settings.';
$string['customfield_notvisible'] = 'Nobody';
@ -35,10 +39,38 @@ $string['customfield_visibility_help'] = 'This setting determines who can view t
$string['customfield_visibletoall'] = 'Everyone';
$string['customfield_visibletoteachers'] = 'Teachers';
$string['customfieldsettings'] = 'Settings for course custom fields';
$string['errorendbeforestart'] = 'The end date ({$a}) is before the course start date.';
$string['favourite'] = 'Starred course';
$string['gradetopassnotset'] = 'This course does not have a grade to pass set. It may be set in the grade item of the course (Gradebook setup).';
$string['nocourseactivity'] = 'Not enough course activity between the start and the end of the course';
$string['nocourseendtime'] = 'The course does not have an end time';
$string['nocoursesections'] = 'No course sections';
$string['nocoursestudents'] = 'No students';
$string['privacy:perpage'] = 'The number of courses to show per page.';
$string['privacy:completionpath'] = 'Course completion';
$string['privacy:favouritespath'] = 'Course starred information';
$string['privacy:metadata:completionsummary'] = 'The course contains completion information about the user.';
$string['privacy:metadata:favouritessummary'] = 'The course contains information relating to the course being starred by the user.';
$string['studentsatriskincourse'] = 'Students at risk in {$a} course';
$string['target:coursecompletion'] = 'Students at risk of not meeting the course completion conditions';
$string['target:coursecompletion_help'] = 'This target describes whether the student is considered at risk of not meeting the course completion conditions.';
$string['target:coursecompetencies'] = 'Students at risk of not achieving the competencies assigned to a course';
$string['target:coursecompetencies_help'] = 'This target describes whether a student is at risk of not achieving the competencies assigned to a course. This target considers that all competencies assigned to the course must be achieved by the end of the course.';
$string['target:coursedropout'] = 'Students at risk of dropping out';
$string['target:coursedropout_help'] = 'This target describes whether the student is considered at risk of dropping out.';
$string['target:coursegradetopass'] = 'Students at risk of not getting the minimum grade to pass the course.';
$string['target:coursegradetopass_help'] = 'This target describes whether the student is at risk of not getting the minimum grade to pass the course.';
$string['target:noteachingactivity'] = 'No teaching';
$string['target:noteachingactivity_help'] = 'This target describes whether courses due to start in the coming week will have teaching activity.';
$string['target:upcomingactivitiesdue'] = 'Upcoming activities due';
$string['target:upcomingactivitiesdue_help'] = 'This target generates reminders for upcoming activities due.';
$string['targetlabelstudentcompletionno'] = 'Student who is likely to meet the course completion conditions';
$string['targetlabelstudentcompletionyes'] = 'Student at risk of not meeting the course completion conditions';
$string['targetlabelstudentcompetenciesno'] = 'Student who is likely to achieve the competencies assigned to a course';
$string['targetlabelstudentcompetenciesyes'] = 'Student at risk of not achieving the competencies assigned to a course';
$string['targetlabelstudentdropoutyes'] = 'Student at risk of dropping out';
$string['targetlabelstudentdropoutno'] = 'Not at risk';
$string['targetlabelstudentgradetopassno'] = 'Student who is likely to meet the minimum grade to pass the course.';
$string['targetlabelstudentgradetopassyes'] = 'Student at risk of not meeting the minimum grade to pass the course.';
$string['targetlabelteachingyes'] = 'Users with teaching capabilities have access to the course';
$string['targetlabelteachingno'] = 'No teaching';

View File

@ -295,7 +295,6 @@ $string['counteditems'] = '{$a->count} {$a->items}';
$string['country'] = 'Country';
$string['course'] = 'Course';
$string['courseadministration'] = 'Course administration';
$string['coursealreadyfinished'] = 'Course already finished';
$string['courseapprovedemail'] = 'Your requested course, {$a->name}, has been approved and you have been made a {$a->teacher}. To access your new course, go to {$a->url}';
$string['courseapprovedemail2'] = 'Your requested course, {$a->name}, has been approved. To access your new course, go to {$a->url}';
$string['courseapprovedfailed'] = 'Failed to save the course as approved!';
@ -340,8 +339,6 @@ $string['coursehelpnewsitemsnumber'] = 'Number of recent announcements appearing
$string['coursehelpnumberweeks'] = 'Number of sections in the course (applies to certain course formats only).';
$string['coursehelpshowgrades'] = 'Enable the display of the gradebook. It does not prevent grades from being displayed within the individual activities.';
$string['coursehidden'] = 'This course is currently unavailable to students';
$string['coursenotyetstarted'] = 'The course has not yet started';
$string['coursenotyetfinished'] = 'The course has not yet finished';
$string['courseoverviewfiles'] = 'Course image';
$string['courseoverviewfilesext'] = 'Course image file extensions';
$string['courseoverviewfileslimit'] = 'Course image files limit';
@ -1384,13 +1381,9 @@ $string['nextsection'] = 'Next section';
$string['no'] = 'No';
$string['noblockstoaddhere'] = 'There are no blocks that you can add to this page.';
$string['nobody'] = 'Nobody';
$string['nocourseactivity'] = 'Not enough course activity between the start and the end of the course';
$string['nocourseendtime'] = 'The course does not have an end time';
$string['nocourses'] = 'No courses';
$string['nocoursesections'] = 'No course sections';
$string['nocoursesfound'] = 'No courses were found with the words \'{$a}\'';
$string['nocoursestarttime'] = 'The course does not have a start date.';
$string['nocoursestudents'] = 'No students';
$string['nocoursesyet'] = 'No courses in this category';
$string['nocomments'] = 'No comments';
$string['nodstpresets'] = 'The administrator has not enabled Daylight Savings Time support.';
@ -1952,7 +1945,6 @@ $string['stringsnotset'] = 'The following strings are not defined in {$a}';
$string['studentnotallowed'] = 'Sorry, but you can not enter this course as \'{$a}\'';
$string['students'] = 'Students';
$string['studentsandteachers'] = 'Students and teachers';
$string['studentsatriskincourse'] = 'Students at risk in {$a} course';
$string['subcategories'] = 'Subcategories';
$string['subcategory'] = 'Subcategory';
$string['subcategoryof'] = 'Subcategory of {$a}';
@ -1976,28 +1968,6 @@ $string['tag'] = 'Tag';
$string['tagalready'] = 'This tag already exists';
$string['tagmanagement'] = 'Add/delete tags ...';
$string['tags'] = 'Tags';
$string['target:coursecompletion'] = 'Students at risk of not meeting the course completion conditions';
$string['target:coursecompletion_help'] = 'This target describes whether the student is considered at risk of not meeting the course completion conditions.';
$string['target:coursecompetencies'] = 'Students at risk of not achieving the competencies assigned to a course';
$string['target:coursecompetencies_help'] = 'This target describes whether a student is at risk of not achieving the competencies assigned to a course. This target considers that all competencies assigned to the course must be achieved by the end of the course.';
$string['target:coursedropout'] = 'Students at risk of dropping out';
$string['target:coursedropout_help'] = 'This target describes whether the student is considered at risk of dropping out.';
$string['target:coursegradetopass'] = 'Students at risk of not getting the minimum grade to pass the course.';
$string['target:coursegradetopass_help'] = 'This target describes whether the student is at risk of not getting the minimum grade to pass the course.';
$string['target:noteachingactivity'] = 'No teaching';
$string['target:noteachingactivity_help'] = 'This target describes whether courses due to start in the coming week will have teaching activity.';
$string['target:upcomingactivitiesdue'] = 'Upcoming activities due';
$string['target:upcomingactivitiesdue_help'] = 'This target generates reminders for upcoming activities due.';
$string['targetlabelstudentcompletionno'] = 'Student who is likely to meet the course completion conditions';
$string['targetlabelstudentcompletionyes'] = 'Student at risk of not meeting the course completion conditions';
$string['targetlabelstudentcompetenciesno'] = 'Student who is likely to achieve the competencies assigned to a course';
$string['targetlabelstudentcompetenciesyes'] = 'Student at risk of not achieving the competencies assigned to a course';
$string['targetlabelstudentdropoutyes'] = 'Student at risk of dropping out';
$string['targetlabelstudentdropoutno'] = 'Not at risk';
$string['targetlabelstudentgradetopassno'] = 'Student who is likely to meet the minimum grade to pass the course.';
$string['targetlabelstudentgradetopassyes'] = 'Student at risk of not meeting the minimum grade to pass the course.';
$string['targetlabelteachingyes'] = 'Users with teaching capabilities have access to the course';
$string['targetlabelteachingno'] = 'No teaching';
$string['targetrole'] = 'Target role';
$string['teacheronly'] = 'for the {$a} only';
$string['teacherroles'] = '{$a} roles';

View File

@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die();
$models = [
[
'target' => '\core\analytics\target\course_dropout',
'target' => '\core_course\analytics\target\course_dropout',
'indicators' => [
'\core\analytics\indicator\any_access_after_end',
'\core\analytics\indicator\any_access_before_start',
@ -81,7 +81,7 @@ $models = [
],
],
[
'target' => '\core\analytics\target\no_teaching',
'target' => '\core_course\analytics\target\no_teaching',
'indicators' => [
'\core_course\analytics\indicator\no_teacher',
'\core_course\analytics\indicator\no_student',

View File

@ -38,4 +38,9 @@ defined('MOODLE_INTERNAL') || die();
$renamedclasses = array(
'course_in_list' => 'core_course_list_element',
'coursecat' => 'core_course_category',
'core\\analytics\\target\\course_dropout' => 'core_course\\analytics\\target\\course_dropout',
'core\\analytics\\target\\course_competencies' => 'core_course\\analytics\\target\\course_competencies',
'core\\analytics\\target\\course_completion' => 'core_course\\analytics\\target\\course_completion',
'core\\analytics\\target\\course_gradetopass' => 'core_course\\analytics\\target\\course_gradetopass',
'core\\analytics\\target\\no_teaching' => 'core_course\\analytics\\target\\no_teaching',
);

View File

@ -3184,5 +3184,29 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2019041800.01);
}
if ($oldversion < 2019041900.00) {
$params = [
'target' => '\core\analytics\target\no_teaching',
];
$models = $DB->get_records('analytics_models', $params);
foreach ($models as $model) {
$model->target = '\core_course\analytics\target\no_teaching';
$DB->update_record('analytics_models', $model);
}
$params = [
'target' => '\core\analytics\target\course_dropout',
];
$models = $DB->get_records('analytics_models', $params);
foreach ($models as $model) {
$model->target = '\core_course\analytics\target\course_dropout';
$DB->update_record('analytics_models', $model);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2019041900.00);
}
return true;
}

View File

@ -60,7 +60,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
'enablecompletion' => 1,
'startdate' => mktime(0, 0, 0, 10, 24, $year + 1)
],
'isvalid' => get_string('coursenotyetstarted')
'isvalid' => get_string('coursenotyetstarted', 'course')
],
'coursenostudents' => [
'params' => [
@ -68,7 +68,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
'startdate' => mktime(0, 0, 0, 10, 24, $year - 2),
'enddate' => mktime(0, 0, 0, 10, 24, $year - 1)
],
'isvalid' => get_string('nocoursestudents')
'isvalid' => get_string('nocoursestudents', 'course')
],
'coursenosections' => [
'params' => [
@ -76,7 +76,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
'format' => 'social',
'students' => true
],
'isvalid' => get_string('nocoursesections')
'isvalid' => get_string('nocoursesections', 'course')
],
'coursenoendtime' => [
'params' => [
@ -85,7 +85,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
'enddate' => 0,
'students' => true
],
'isvalid' => get_string('nocourseendtime')
'isvalid' => get_string('nocourseendtime', 'course')
],
'courseendbeforestart' => [
'params' => [
@ -93,7 +93,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
'enddate' => mktime(0, 0, 0, 10, 23, $year - 2),
'students' => true
],
'isvalid' => get_string('errorendbeforestart', 'analytics')
'isvalid' => get_string('errorendbeforestart', 'course')
],
'coursetoolong' => [
'params' => [
@ -102,7 +102,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
'enddate' => mktime(0, 0, 0, 10, 23, $year),
'students' => true
],
'isvalid' => get_string('coursetoolong', 'analytics')
'isvalid' => get_string('coursetoolong', 'course')
],
'coursealreadyfinished' => [
'params' => [
@ -111,7 +111,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
'enddate' => mktime(0, 0, 0, 10, 23, $year - 1),
'students' => true
],
'isvalid' => get_string('coursealreadyfinished'),
'isvalid' => get_string('coursealreadyfinished', 'course'),
'fortraining' => false
],
'coursenotyetfinished' => [
@ -121,7 +121,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
'enddate' => mktime(0, 0, 0, $month + 2, 23, $year),
'students' => true
],
'isvalid' => get_string('coursenotyetfinished')
'isvalid' => get_string('coursenotyetfinished', 'course')
],
'coursenocompletion' => [
'params' => [
@ -207,7 +207,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
$criterion->update_config($criteriadata);
}
$target = new \core\analytics\target\course_completion();
$target = new \core_course\analytics\target\course_completion();
// Test valid analysables.
@ -242,7 +242,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
$course = $this->getDataGenerator()->create_course($courserecord);
$this->getDataGenerator()->enrol_user($user->id, $course->id, null, 'manual', $timestart, $timeend);
$target = new \core\analytics\target\course_completion();
$target = new \core_course\analytics\target\course_completion();
$analyser = new \core\analytics\analyser\student_enrolments(1, $target, [], [], []);
$analysable = new \core_analytics\course($course);
@ -303,7 +303,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
$data = $this->setup_competencies_environment();
$analysable = new \core_analytics\course($data['course']);
$target = new \core\analytics\target\course_competencies();
$target = new \core_course\analytics\target\course_competencies();
$this->assertTrue($target->is_valid_analysable($analysable));
@ -318,7 +318,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
$data = $this->setup_competencies_environment();
$target = new \core\analytics\target\course_competencies();
$target = new \core_course\analytics\target\course_competencies();
$analyser = new \core\analytics\analyser\student_enrolments(1, $target, [], [], []);
$analysable = new \core_analytics\course($data['course']);
@ -330,7 +330,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
$target->add_sample_data($samplesdata);
$sampleid = reset($sampleids);
$class = new ReflectionClass('\core\analytics\target\course_competencies');
$class = new ReflectionClass('\core_course\analytics\target\course_competencies');
$method = $class->getMethod('calculate_sample');
$method->setAccessible(true);
@ -364,7 +364,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
$dg->enrol_user($student1->id, $course1->id, $studentrole->id);
$analysable = new \core_analytics\course($course1);
$target = new \core\analytics\target\course_gradetopass();
$target = new \core_course\analytics\target\course_gradetopass();
$this->assertEquals(get_string('gradetopassnotset', 'course'), $target->is_valid_analysable($analysable));
// Set grade to pass.
@ -372,7 +372,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
$courseitem->gradepass = 50;
$DB->update_record('grade_items', $courseitem);
// Since the grade to pass value is cached in the target, a new one it is instanciated.
$target = new \core\analytics\target\course_gradetopass();
$target = new \core_course\analytics\target\course_gradetopass();
$this->assertTrue($target->is_valid_analysable($analysable));
}
@ -416,7 +416,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
$courseitem->gradepass = 50;
$DB->update_record('grade_items', $courseitem);
$target = new \core\analytics\target\course_gradetopass();
$target = new \core_course\analytics\target\course_gradetopass();
$analyser = new \core\analytics\analyser\student_enrolments(1, $target, [], [], []);
$analysable = new \core_analytics\course($course1);
@ -427,7 +427,7 @@ class core_analytics_targets_testcase extends advanced_testcase {
list($sampleids, $samplesdata) = $method->invoke($analyser, $analysable);
$target->add_sample_data($samplesdata);
$class = new ReflectionClass('\core\analytics\target\course_gradetopass');
$class = new ReflectionClass('\core_course\analytics\target\course_gradetopass');
$method = $class->getMethod('calculate_sample');
$method->setAccessible(true);

View File

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2019041800.02; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2019041900.00; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.