diff --git a/admin/tool/analytics/templates/restorable_models.mustache b/admin/tool/analytics/templates/restorable_models.mustache index da85f7bdf67..fe19e2d2ca3 100644 --- a/admin/tool/analytics/templates/restorable_models.mustache +++ b/admin/tool/analytics/templates/restorable_models.mustache @@ -58,7 +58,7 @@ "models": [ { "defid": "id24680aceg", - "targetname": "No teaching", + "targetname": "Courses at risk of not starting", "targetclass": "\\core\\analytics\\target\\no_teaching", "indicatorsnum": 2, "indicators": [ diff --git a/admin/tool/analytics/tests/behat/restoredefault.feature b/admin/tool/analytics/tests/behat/restoredefault.feature index f819e5f7925..b9a4578323a 100644 --- a/admin/tool/analytics/tests/behat/restoredefault.feature +++ b/admin/tool/analytics/tests/behat/restoredefault.feature @@ -15,55 +15,55 @@ Feature: Restoring default models Scenario: Restore a single deleted default model Given I log in as "manager" And I navigate to "Analytics > Analytics models" in site administration - # Delete 'No teaching' model. - And I click on "Delete" "link" in the "No teaching" "table_row" + # Delete 'Courses at risk of not starting' model. + And I click on "Delete" "link" in the "Courses at risk of not starting" "table_row" And I should see "Analytics models" - And I should not see "No teaching" + And I should not see "Courses at risk of not starting" # Delete 'Students at risk of dropping out' model. And I click on "Delete" "link" in the "Students at risk of dropping out" "table_row" And I should see "Analytics models" And I should not see "Students at risk of dropping out" # Go to the page for restoring deleted models. When I click on "Restore default models" "link" - And I should see "No teaching" + And I should see "Courses at risk of not starting" And I should see "Students at risk of dropping out" - # Select and restore the 'No teaching' model. - And I set the field with xpath "//tr[contains(normalize-space(.), 'No teaching')]//input[@type='checkbox']" to "1" + # Select and restore the 'Courses at risk of not starting' model. + And I set the field with xpath "//tr[contains(normalize-space(.), 'Courses at risk of not starting')]//input[@type='checkbox']" to "1" And I click on "Restore selected" "button" Then I should see "Succesfully re-created 1 new model(s)." And I should see "Analytics models" - And I should see "No teaching" + And I should see "Courses at risk of not starting" And I should not see "Students at risk of dropping out" Scenario: Restore multiple deleted default models at once Given I log in as "manager" And I navigate to "Analytics > Analytics models" in site administration - # Delete 'No teaching' model. - And I click on "Delete" "link" in the "No teaching" "table_row" + # Delete 'Courses at risk of not starting' model. + And I click on "Delete" "link" in the "Courses at risk of not starting" "table_row" And I should see "Analytics models" - And I should not see "No teaching" + And I should not see "Courses at risk of not starting" # Delete 'Students at risk of dropping out' model. And I click on "Delete" "link" in the "Students at risk of dropping out" "table_row" And I should see "Analytics models" And I should not see "Students at risk of dropping out" # Go to the page for restoring deleted models. When I click on "Restore default models" "link" - And I should see "No teaching" + And I should see "Courses at risk of not starting" And I should see "Students at risk of dropping out" # Select and restore both models. - And I set the field with xpath "//tr[contains(normalize-space(.), 'No teaching')]//input[@type='checkbox']" to "1" + And I set the field with xpath "//tr[contains(normalize-space(.), 'Courses at risk of not starting')]//input[@type='checkbox']" to "1" And I set the field with xpath "//tr[contains(normalize-space(.), 'Students at risk of dropping out')]//input[@type='checkbox']" to "1" And I click on "Restore selected" "button" Then I should see "Succesfully re-created 2 new model(s)." And I should see "Analytics models" - And I should see "No teaching" + And I should see "Courses at risk of not starting" And I should see "Students at risk of dropping out" Scenario: Going to the restore page while no models can be restored Given I log in as "manager" And I navigate to "Analytics > Analytics models" in site administration And I should see "Analytics models" - And I should see "No teaching" + And I should see "Courses at risk of not starting" When I click on "Restore default models" "link" Then I should see "All default models provided by core and installed plugins have been created. No new models were found; there is nothing to restore." And I click on "Back" "link" @@ -73,23 +73,23 @@ Feature: Restoring default models Scenario: User can select and restore all missing models Given I log in as "manager" And I navigate to "Analytics > Analytics models" in site administration - # Delete 'No teaching' model. - And I click on "Actions" "link" in the "No teaching" "table_row" - And I click on "Delete" "link" in the "No teaching" "table_row" + # Delete 'Courses at risk of not starting' model. + And I click on "Actions" "link" in the "Courses at risk of not starting" "table_row" + And I click on "Delete" "link" in the "Courses at risk of not starting" "table_row" And I click on "Delete" "button" in the "Delete" "dialogue" And I should see "Analytics models" - And I should not see "No teaching" + And I should not see "Courses at risk of not starting" # Delete 'Students at risk of dropping out' model. And I click on "Actions" "link" in the "Students at risk of dropping out" "table_row" And I click on "Delete" "link" in the "Students at risk of dropping out" "table_row" And I click on "Delete" "button" in the "Delete" "dialogue" And I should see "Analytics models" - And I should not see "No teaching" + And I should not see "Courses at risk of not starting" And I should not see "Students at risk of dropping out" # Go to the page for restoring deleted models. And I click on "New model" "link" And I click on "Restore default models" "link" - And I should see "No teaching" + And I should see "Courses at risk of not starting" And I should see "Students at risk of dropping out" # Attempt to submit the form without selecting any model. And I click on "Restore selected" "button" @@ -99,5 +99,5 @@ Feature: Restoring default models And I click on "Restore selected" "button" Then I should see "Succesfully re-created 2 new model(s)." And I should see "Analytics models" - And I should see "No teaching" + And I should see "Courses at risk of not starting" And I should see "Students at risk of dropping out" diff --git a/course/classes/analytics/indicator/no_student.php b/course/classes/analytics/indicator/no_student.php index a55df3893a7..30b872e7381 100644 --- a/course/classes/analytics/indicator/no_student.php +++ b/course/classes/analytics/indicator/no_student.php @@ -64,23 +64,6 @@ class no_student extends \core_analytics\local\indicator\binary { return array('context', 'course'); } - /** - * Reversed because the indicator is in 'negative' and the max returned value means student present. - * - * @param float $value - * @param string $subtype - * @return string - */ - public function get_display_value($value, $subtype = false) { - - // No subtypes for binary values by default. - if ($value == -1) { - return get_string('yes'); - } else if ($value == 1) { - return get_string('no'); - } - } - /** * calculate_sample * diff --git a/course/classes/analytics/indicator/no_teacher.php b/course/classes/analytics/indicator/no_teacher.php index ade6901b95e..a2d7833a23f 100644 --- a/course/classes/analytics/indicator/no_teacher.php +++ b/course/classes/analytics/indicator/no_teacher.php @@ -64,23 +64,6 @@ class no_teacher extends \core_analytics\local\indicator\binary { return array('context', 'course'); } - /** - * Reversed because the indicator is in 'negative' and the max returned value means teacher present. - * - * @param float $value - * @param string $subtype - * @return string - */ - public function get_display_value($value, $subtype = false) { - - // No subtypes for binary values by default. - if ($value == -1) { - return get_string('yes'); - } else if ($value == 1) { - return get_string('no'); - } - } - /** * calculate_sample * diff --git a/course/classes/analytics/target/no_teaching.php b/course/classes/analytics/target/no_teaching.php index 425e683fc4b..0c4f158cd62 100644 --- a/course/classes/analytics/target/no_teaching.php +++ b/course/classes/analytics/target/no_teaching.php @@ -76,6 +76,27 @@ class no_teaching extends \core_analytics\local\target\binary { return get_string('noteachingupcomingcourses'); } + /** + * Returns the body message for the insight. + * + * @param \context $context + * @param string $contextname + * @param \stdClass $user + * @param \moodle_url $insighturl + * @return string[] The plain text message and the HTML message + */ + public function get_insight_body(\context $context, string $contextname, \stdClass $user, \moodle_url $insighturl): array { + global $OUTPUT; + + $a = (object)['userfirstname' => $user->firstname]; + $fullmessage = get_string('noteachinginfomessage', 'course', $a) . PHP_EOL . PHP_EOL . $insighturl->out(false); + $fullmessagehtml = $OUTPUT->render_from_template('core_analytics/insight_info_message', + ['url' => $insighturl->out(false), 'insightinfomessage' => get_string('noteachinginfomessage', 'course', $a)] + ); + + return [$fullmessage, $fullmessagehtml]; + } + /** * prediction_actions * diff --git a/lang/en/course.php b/lang/en/course.php index 01153a50680..b7357355557 100644 --- a/lang/en/course.php +++ b/lang/en/course.php @@ -46,6 +46,9 @@ $string['nocourseactivity'] = 'Not enough course activity between the start and $string['nocourseendtime'] = 'The course does not have an end time'; $string['nocoursesections'] = 'No course sections'; $string['nocoursestudents'] = 'No students'; +$string['noteachinginfomessage'] = 'Hi {$a->userfirstname}, + +

Courses with start dates in the next week have been identified as having no teacher or student enrolments.'; $string['privacy:perpage'] = 'The number of courses to show per page.'; $string['privacy:completionpath'] = 'Course completion'; $string['privacy:favouritespath'] = 'Course starred information'; @@ -63,7 +66,7 @@ $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 achieving the minimum grade to pass the course'; $string['target:coursegradetopass_help'] = 'This target describes whether the student is at risk of not achieving the minimum grade to pass the course.'; -$string['target:noteachingactivity'] = 'No teaching'; +$string['target:noteachingactivity'] = 'Courses at risk of not starting'; $string['target:noteachingactivity_help'] = 'This target describes whether courses due to start in the coming week will have teaching activity.'; $string['targetlabelstudentcompletionno'] = 'Student who is likely to meet the course completion conditions'; $string['targetlabelstudentcompletionyes'] = 'Student at risk of not meeting the course completion conditions'; @@ -74,4 +77,4 @@ $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 who have access to the course'; -$string['targetlabelteachingno'] = 'No teaching'; +$string['targetlabelteachingno'] = 'Courses at risk of not starting'; diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 320b511286d..e190711e381 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -1053,10 +1053,10 @@ $string['indicator:completeduserprofile'] = 'User profile is completed'; $string['indicator:completeduserprofile_help'] = 'This indicator represents that the student has completed their user profile.'; $string['indicator:completionenabled'] = 'Completion tracking enabled'; $string['indicator:completionenabled_help'] = 'This indicator represents that completion tracking has been enabled for this course.'; -$string['indicator:nostudent'] = 'There are no students'; -$string['indicator:nostudent_help'] = 'This indicator reflects that this course has no students.'; -$string['indicator:noteacher'] = 'There are no teachers'; -$string['indicator:noteacher_help'] = 'This indicator reflects that this course has no teachers.'; +$string['indicator:nostudent'] = 'Student enrolments'; +$string['indicator:nostudent_help'] = 'This indicator reflects the availability of students in the course.'; +$string['indicator:noteacher'] = 'Teacher availability'; +$string['indicator:noteacher_help'] = 'This indicator reflects the availability of teachers in the course.'; $string['indicator:potentialcognitive'] = 'Course potential cognitive depth'; $string['indicator:potentialcognitive_help'] = 'This indicator is based on the potential cognitive depth that could be reached by a student participating in course activities.'; $string['indicator:potentialsocial'] = 'Course potential social breadth';