diff --git a/analytics/classes/local/indicator/assign/activity_base.php b/analytics/classes/local/indicator/assign/activity_base.php index 51deb074a5e..f2de8d1ffcd 100644 --- a/analytics/classes/local/indicator/assign/activity_base.php +++ b/analytics/classes/local/indicator/assign/activity_base.php @@ -42,4 +42,13 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o protected function get_activity_type() { return 'assign'; } + + protected function feedback_viewed_events() { + return array('\mod_assign\event\feedback_viewed'); + } + + protected function feedback_check_grades() { + // We need the grade to be released to the student to consider that feedback has been provided. + return true; + } } diff --git a/analytics/classes/local/indicator/assign/cognitive_depth.php b/analytics/classes/local/indicator/assign/cognitive_depth.php index 546dd90935c..b33c0d7533e 100644 --- a/analytics/classes/local/indicator/assign/cognitive_depth.php +++ b/analytics/classes/local/indicator/assign/cognitive_depth.php @@ -43,10 +43,6 @@ class cognitive_depth extends activity_base { return 5; } - protected function feedback_viewed_events() { - return array('\mod_assign\event\feedback_viewed'); - } - protected function feedback_submitted_events() { return array('\mod_assign\event\assessable_submitted'); } @@ -56,8 +52,4 @@ class cognitive_depth extends activity_base { return false; } - protected function feedback_check_grades() { - // We need the grade to be released to the student to consider that feedback has been provided. - return true; - } } diff --git a/analytics/classes/local/indicator/chat/activity_base.php b/analytics/classes/local/indicator/chat/activity_base.php index 3ac0f4bf117..270ebeae8bd 100644 --- a/analytics/classes/local/indicator/chat/activity_base.php +++ b/analytics/classes/local/indicator/chat/activity_base.php @@ -42,4 +42,49 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o protected function get_activity_type() { return 'chat'; } + + protected function feedback_viewed_events() { + return array('\mod_chat\event\course_module_viewed', '\mod_chat\event\message_sent', + '\mod_chat\event\sessions_viewed'); + } + + protected function feedback_post_action(\cm_info $cm, $contextid, $userid, $eventnames, $after = false) { + + if (empty($this->activitylogs[$contextid][$userid])) { + return false; + } + + $logs = $this->activitylogs[$contextid][$userid]; + + if (empty($logs['\mod_chat\event\message_sent'])) { + // No feedback viewed if there is no submission. + return false; + } + + // First user message time. + $firstmessage = $logs['\mod_chat\event\message_sent']->timecreated[0]; + + // We consider feedback another user messages. + foreach ($this->activitylogs[$contextid] as $anotheruserid => $logs) { + if ($anotheruserid == $userid) { + continue; + } + if (empty($logs['\mod_chat\event\message_sent'])) { + continue; + } + $firstmessagesenttime = $logs['\mod_chat\event\message_sent']->timecreated[0]; + + if (parent::feedback_post_action($cm, $contextid, $userid, $eventnames, $firstmessagesenttime)) { + return true; + } + // Continue with the next user. + } + + return false; + } + + protected function feedback_check_grades() { + // Chat's feedback is not contained in grades. + return false; + } } diff --git a/analytics/classes/local/indicator/chat/cognitive_depth.php b/analytics/classes/local/indicator/chat/cognitive_depth.php index 780c4a28efb..d9e697d00d1 100644 --- a/analytics/classes/local/indicator/chat/cognitive_depth.php +++ b/analytics/classes/local/indicator/chat/cognitive_depth.php @@ -43,52 +43,8 @@ class cognitive_depth extends activity_base { return 4; } - protected function feedback_viewed_events() { - return array('\mod_chat\event\course_module_viewed', '\mod_chat\event\message_sent', - '\mod_chat\event\sessions_viewed'); - } - protected function feedback_replied_events() { return array('\mod_chat\event\message_sent'); } - protected function feedback_post_action(\cm_info $cm, $contextid, $userid, $eventnames, $after = false) { - - if (empty($this->activitylogs[$contextid][$userid])) { - return false; - } - - $logs = $this->activitylogs[$contextid][$userid]; - - if (empty($logs['\mod_chat\event\message_sent'])) { - // No feedback viewed if there is no submission. - return false; - } - - // First user message time. - $firstmessage = $logs['\mod_chat\event\message_sent']->timecreated[0]; - - // We consider feedback another user messages. - foreach ($this->activitylogs[$contextid] as $anotheruserid => $logs) { - if ($anotheruserid == $userid) { - continue; - } - if (empty($logs['\mod_chat\event\message_sent'])) { - continue; - } - $firstmessagesenttime = $logs['\mod_chat\event\message_sent']->timecreated[0]; - - if (parent::feedback_post_action($cm, $contextid, $userid, $eventnames, $firstmessagesenttime)) { - return true; - } - // Continue with the next user. - } - - return false; - } - - protected function feedback_check_grades() { - // Chat's feedback is not contained in grades. - return false; - } } diff --git a/analytics/classes/local/indicator/forum/activity_base.php b/analytics/classes/local/indicator/forum/activity_base.php index da3b9e13a97..b4c71c20266 100644 --- a/analytics/classes/local/indicator/forum/activity_base.php +++ b/analytics/classes/local/indicator/forum/activity_base.php @@ -42,4 +42,44 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o protected function get_activity_type() { return 'forum'; } + + protected function feedback_viewed_events() { + // We could add any forum event, but it will make feedback_post_action slower + return array('\mod_forum\event\assessable_uploaded', '\mod_forum\event\course_module_viewed', '\mod_forum\event\discussion_viewed'); + } + + protected function feedback_post_action(\cm_info $cm, $contextid, $userid, $eventnames, $after = false) { + + if (empty($this->activitylogs[$contextid][$userid])) { + return false; + } + + $logs = $this->activitylogs[$contextid][$userid]; + + if (empty($logs['\mod_forum\event\assessable_uploaded'])) { + // No feedback viewed if there is no submission. + return false; + } + + // First user post time. + $firstpost = $logs['\mod_forum\event\assessable_uploaded']->timecreated[0]; + + // We consider feedback any other user post in any of this forum discussions. + foreach ($this->activitylogs[$contextid] as $anotheruserid => $logs) { + if ($anotheruserid == $userid) { + continue; + } + if (empty($logs['\mod_forum\event\assessable_uploaded'])) { + continue; + } + $firstpostsenttime = $logs['\mod_forum\event\assessable_uploaded']->timecreated[0]; + + if (parent::feedback_post_action($cm, $contextid, $userid, $eventnames, $firstpostsenttime)) { + return true; + } + // Continue with the next user. + } + + return false; + } } diff --git a/analytics/classes/local/indicator/forum/cognitive_depth.php b/analytics/classes/local/indicator/forum/cognitive_depth.php index eb36b643330..c35b33b9185 100644 --- a/analytics/classes/local/indicator/forum/cognitive_depth.php +++ b/analytics/classes/local/indicator/forum/cognitive_depth.php @@ -47,47 +47,8 @@ class cognitive_depth extends activity_base { return false; } - protected function feedback_viewed_events() { - // We could add any forum event, but it will make feedback_post_action slower - return array('\mod_forum\event\assessable_uploaded', '\mod_forum\event\course_module_viewed', '\mod_forum\event\discussion_viewed'); - } - protected function feedback_replied_events() { return array('\mod_forum\event\assessable_uploaded'); } - protected function feedback_post_action(\cm_info $cm, $contextid, $userid, $eventnames, $after = false) { - - if (empty($this->activitylogs[$contextid][$userid])) { - return false; - } - - $logs = $this->activitylogs[$contextid][$userid]; - - if (empty($logs['\mod_forum\event\assessable_uploaded'])) { - // No feedback viewed if there is no submission. - return false; - } - - // First user post time. - $firstpost = $logs['\mod_forum\event\assessable_uploaded']->timecreated[0]; - - // We consider feedback any other user post in any of this forum discussions. - foreach ($this->activitylogs[$contextid] as $anotheruserid => $logs) { - if ($anotheruserid == $userid) { - continue; - } - if (empty($logs['\mod_forum\event\assessable_uploaded'])) { - continue; - } - $firstpostsenttime = $logs['\mod_forum\event\assessable_uploaded']->timecreated[0]; - - if (parent::feedback_post_action($cm, $contextid, $userid, $eventnames, $firstpostsenttime)) { - return true; - } - // Continue with the next user. - } - - return false; - } } diff --git a/analytics/classes/local/indicator/lesson/activity_base.php b/analytics/classes/local/indicator/lesson/activity_base.php index ca40088ce31..7863c282ca4 100644 --- a/analytics/classes/local/indicator/lesson/activity_base.php +++ b/analytics/classes/local/indicator/lesson/activity_base.php @@ -42,4 +42,13 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o protected function get_activity_type() { return 'lesson'; } + + protected function feedback_viewed_events() { + return array('\mod_lesson\event\lesson_ended'); + } + + protected function feedback_check_grades() { + // We don't need to check grades as we get the feedback while completing the activity. + return false; + } } diff --git a/analytics/classes/local/indicator/lesson/cognitive_depth.php b/analytics/classes/local/indicator/lesson/cognitive_depth.php index 62f9571e191..bb5ee31e0cd 100644 --- a/analytics/classes/local/indicator/lesson/cognitive_depth.php +++ b/analytics/classes/local/indicator/lesson/cognitive_depth.php @@ -43,10 +43,6 @@ class cognitive_depth extends activity_base { return 5; } - protected function feedback_viewed_events() { - return array('\mod_lesson\event\lesson_ended'); - } - protected function feedback_submitted(\cm_info $cm, $contextid, $userid, $after = false) { if (empty($this->activitylogs[$contextid][$userid]) || empty($this->activitylogs[$contextid][$userid]['\mod_lesson\event\lesson_ended'])) { @@ -57,11 +53,6 @@ class cognitive_depth extends activity_base { return (2 >= count($this->activitylogs[$contextid][$userid]['\mod_lesson\event\lesson_ended'])); } - protected function feedback_check_grades() { - // We don't need to check grades as we get the feedback while completing the activity. - return false; - } - protected function feedback_replied(\cm_info $cm, $contextid, $userid, $after = false) { // No level 4. return false; diff --git a/analytics/classes/local/indicator/lti/activity_base.php b/analytics/classes/local/indicator/lti/activity_base.php index 45e69d88457..df250dd18e9 100644 --- a/analytics/classes/local/indicator/lti/activity_base.php +++ b/analytics/classes/local/indicator/lti/activity_base.php @@ -42,4 +42,9 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o protected function get_activity_type() { return 'lti'; } + + protected function feedback_viewed_events() { + // Any view after the data graded counts as feedback viewed. + return array('\mod_lti\event\course_module_viewed'); + } } diff --git a/analytics/classes/local/indicator/lti/cognitive_depth.php b/analytics/classes/local/indicator/lti/cognitive_depth.php index c1c34176a5f..e0887ffd99a 100644 --- a/analytics/classes/local/indicator/lti/cognitive_depth.php +++ b/analytics/classes/local/indicator/lti/cognitive_depth.php @@ -43,9 +43,4 @@ class cognitive_depth extends activity_base { return 3; } - protected function feedback_viewed_events() { - // Any view after the data graded counts as feedback viewed. - return array('\mod_lti\event\course_module_viewed'); - } - } diff --git a/analytics/classes/local/indicator/quiz/activity_base.php b/analytics/classes/local/indicator/quiz/activity_base.php index 919492e7c2b..d0cbf23a96e 100644 --- a/analytics/classes/local/indicator/quiz/activity_base.php +++ b/analytics/classes/local/indicator/quiz/activity_base.php @@ -42,4 +42,13 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o protected function get_activity_type() { return 'quiz'; } + + protected function feedback_check_grades() { + // We need the grade to be released to the student to consider that feedback has been provided. + return true; + } + + protected function feedback_viewed_events() { + return array('\mod_quiz\event\course_module_viewed'); + } } diff --git a/analytics/classes/local/indicator/quiz/cognitive_depth.php b/analytics/classes/local/indicator/quiz/cognitive_depth.php index 5ad1908f8f5..740f3b0fc40 100644 --- a/analytics/classes/local/indicator/quiz/cognitive_depth.php +++ b/analytics/classes/local/indicator/quiz/cognitive_depth.php @@ -43,15 +43,6 @@ class cognitive_depth extends activity_base { return 5; } - protected function feedback_check_grades() { - // We need the grade to be released to the student to consider that feedback has been provided. - return true; - } - - protected function feedback_viewed_events() { - return array('\mod_quiz\event\course_module_viewed'); - } - protected function feedback_submitted_events() { return array('\mod_quiz\event\attempt_submitted'); } diff --git a/analytics/classes/local/indicator/scorm/activity_base.php b/analytics/classes/local/indicator/scorm/activity_base.php index f1535bbae53..a05a499ecd0 100644 --- a/analytics/classes/local/indicator/scorm/activity_base.php +++ b/analytics/classes/local/indicator/scorm/activity_base.php @@ -42,4 +42,9 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o protected function get_activity_type() { return 'scorm'; } + + protected function feedback_viewed_events() { + // Any view after the data graded counts as feedback viewed. + return array('\mod_scorm\event\course_module_viewed'); + } } diff --git a/analytics/classes/local/indicator/scorm/cognitive_depth.php b/analytics/classes/local/indicator/scorm/cognitive_depth.php index cfd599ba1ae..eb87135d938 100644 --- a/analytics/classes/local/indicator/scorm/cognitive_depth.php +++ b/analytics/classes/local/indicator/scorm/cognitive_depth.php @@ -42,9 +42,4 @@ class cognitive_depth extends activity_base { public function get_cognitive_depth_level(\cm_info $cm) { return 3; } - - protected function feedback_viewed_events() { - // Any view after the data graded counts as feedback viewed. - return array('\mod_scorm\event\course_module_viewed'); - } } diff --git a/analytics/classes/local/indicator/wiki/social_breadth.php b/analytics/classes/local/indicator/wiki/social_breadth.php index cde0afcded6..5bc249d53a8 100644 --- a/analytics/classes/local/indicator/wiki/social_breadth.php +++ b/analytics/classes/local/indicator/wiki/social_breadth.php @@ -40,6 +40,6 @@ class social_breadth extends activity_base { } protected function get_social_breadth_level(\cm_info $cm) { - return 2; + return 1; } } diff --git a/analytics/classes/local/indicator/workshop/activity_base.php b/analytics/classes/local/indicator/workshop/activity_base.php index edc96f8ff7d..7cfab429c72 100644 --- a/analytics/classes/local/indicator/workshop/activity_base.php +++ b/analytics/classes/local/indicator/workshop/activity_base.php @@ -42,4 +42,12 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o protected function get_activity_type() { return 'workshop'; } + + protected function feedback_check_grades() { + return true; + } + + protected function feedback_viewed_events() { + return array('\mod_workshop\event\course_module_viewed', '\mod_workshop\event\submission_viewed'); + } } diff --git a/analytics/classes/local/indicator/workshop/cognitive_depth.php b/analytics/classes/local/indicator/workshop/cognitive_depth.php index 079b13d09b0..c4fc0c0b295 100644 --- a/analytics/classes/local/indicator/workshop/cognitive_depth.php +++ b/analytics/classes/local/indicator/workshop/cognitive_depth.php @@ -43,14 +43,6 @@ class cognitive_depth extends activity_base { return 5; } - protected function feedback_check_grades() { - return true; - } - - protected function feedback_viewed_events() { - return array('\mod_workshop\event\course_module_viewed', '\mod_workshop\event\submission_viewed'); - } - protected function feedback_replied_events() { return array('\mod_workshop\event\submission_assessed', '\mod_workshop\event\submission_reassessed'); }