mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-59057 analytics: no_teaching model fixes
Part of MDL-57791 epic.
This commit is contained in:
parent
b0c2492906
commit
1a8461390b
@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class no_teaching_activity extends \core_analytics\local\target\binary {
|
||||
class no_teaching extends \core_analytics\local\target\binary {
|
||||
|
||||
/**
|
||||
* Machine learning backends are not required to predict.
|
||||
@ -76,8 +76,8 @@ class no_teaching_activity extends \core_analytics\local\target\binary {
|
||||
|
||||
protected static function classes_description() {
|
||||
return array(
|
||||
get_string('labelteachingactivityyes', 'tool_models'),
|
||||
get_string('labelteachingactivityno', 'tool_models'),
|
||||
get_string('labelteachingyes', 'tool_models'),
|
||||
get_string('labelteachingno', 'tool_models'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -119,8 +119,8 @@ class no_teaching_activity extends \core_analytics\local\target\binary {
|
||||
protected function calculate_sample($sampleid, \core_analytics\analysable $site, $starttime = false, $endtime = false) {
|
||||
|
||||
$noteachersindicator = $this->retrieve('\core_course\analytics\indicator\no_teacher', $sampleid);
|
||||
if ($noteachersindicator != \core_course\analytics\indicator\no_teacher::get_min_value()) {
|
||||
// No teachers flagged as 1.
|
||||
if ($noteachersindicator == \core_course\analytics\indicator\no_teacher::get_min_value()) {
|
||||
// No teachers :( we flag this as 1.
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
@ -39,7 +39,7 @@ function xmldb_tool_models_install() {
|
||||
$model->update(0, $model->get_potential_indicators());
|
||||
|
||||
// Course without teachers.
|
||||
$target = \core_analytics\manager::get_target('\tool_models\analytics\target\no_teaching_activity');
|
||||
$target = \core_analytics\manager::get_target('\tool_models\analytics\target\no_teaching');
|
||||
$weekbeforestart = '\core_analytics\local\time_splitting\week_before_course_start';
|
||||
$noteacher = \core_analytics\manager::get_indicator('\core_course\analytics\indicator\no_teacher');
|
||||
\core_analytics\model::create($target, array($noteacher->get_id() => $noteacher), $weekbeforestart);
|
||||
|
@ -55,8 +55,8 @@ $string['indicators'] = 'Indicators';
|
||||
$string['info'] = 'Info';
|
||||
$string['labelstudentdropoutyes'] = 'Student at risk of dropping out';
|
||||
$string['labelstudentdropoutno'] = 'Not at risk';
|
||||
$string['labelteachingactivityyes'] = 'Teaching activity';
|
||||
$string['labelteachingactivityno'] = 'No teaching activity';
|
||||
$string['labelteachingyes'] = 'Users with teaching capabilities have access to the course';
|
||||
$string['labelteachingno'] = 'No teaching';
|
||||
$string['loginfo'] = 'Log extra info';
|
||||
$string['lowaccuracy'] = 'The model accuracy is low';
|
||||
$string['modelresults'] = '{$a} results';
|
||||
@ -81,7 +81,7 @@ $string['samestartdate'] = 'Current start date is good';
|
||||
$string['sameenddate'] = 'Current end date is good';
|
||||
$string['target'] = 'Target';
|
||||
$string['target:coursedropout'] = 'Students at risk of dropping out';
|
||||
$string['target:noteachingactivity'] = 'No teaching activity';
|
||||
$string['target:noteachingactivity'] = 'No teaching';
|
||||
$string['target:coursedropoutinfo'] = 'Here you can find a list of students at risk of dropping out.';
|
||||
$string['timemodified'] = 'Last modification';
|
||||
$string['trainingprocessfinished'] = 'Training process finished';
|
||||
|
@ -45,6 +45,15 @@ class no_teacher extends \core_analytics\local\indicator\binary {
|
||||
return array('context', 'course');
|
||||
}
|
||||
|
||||
/**
|
||||
* calculate_sample
|
||||
*
|
||||
* @param int $sampleid
|
||||
* @param string $sampleorigin
|
||||
* @param int $notusedstarttime
|
||||
* @param int $notusedendtime
|
||||
* @return float
|
||||
*/
|
||||
public function calculate_sample($sampleid, $sampleorigin, $notusedstarttime = false, $notusedendtime = false) {
|
||||
|
||||
$context = $this->retrieve('context', $sampleid);
|
||||
@ -52,7 +61,10 @@ class no_teacher extends \core_analytics\local\indicator\binary {
|
||||
$teacherroles = get_config('analytics', 'teacherroles');
|
||||
$teacherroleids = explode(',', $teacherroles);
|
||||
foreach ($teacherroleids as $role) {
|
||||
if (get_role_users($role, $context)) {
|
||||
// We look for roles, not enrolments as a teacher assigned at category level is supposed to be a
|
||||
// course teacher.
|
||||
$teachers = get_role_users($role, $context, false, 'u.id', 'u.id');
|
||||
if ($teachers) {
|
||||
return self::get_max_value();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user