MDL-59079 core_analytics: Add social level 2 to various activities

Part of MDL-57791 epic.
This commit is contained in:
Ankit Agarwal 2017-05-31 15:18:29 +05:30 committed by David Monllao
parent a6805cc8e0
commit 3c305df1de
17 changed files with 131 additions and 128 deletions

View File

@ -42,4 +42,13 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o
protected function get_activity_type() { protected function get_activity_type() {
return 'assign'; 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;
}
} }

View File

@ -43,10 +43,6 @@ class cognitive_depth extends activity_base {
return 5; return 5;
} }
protected function feedback_viewed_events() {
return array('\mod_assign\event\feedback_viewed');
}
protected function feedback_submitted_events() { protected function feedback_submitted_events() {
return array('\mod_assign\event\assessable_submitted'); return array('\mod_assign\event\assessable_submitted');
} }
@ -56,8 +52,4 @@ class cognitive_depth extends activity_base {
return false; 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;
}
} }

View File

@ -42,4 +42,49 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o
protected function get_activity_type() { protected function get_activity_type() {
return 'chat'; 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;
}
} }

View File

@ -43,52 +43,8 @@ class cognitive_depth extends activity_base {
return 4; 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() { protected function feedback_replied_events() {
return array('\mod_chat\event\message_sent'); 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;
}
} }

View File

@ -42,4 +42,44 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o
protected function get_activity_type() { protected function get_activity_type() {
return 'forum'; 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;
}
} }

View File

@ -47,47 +47,8 @@ class cognitive_depth extends activity_base {
return false; 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() { protected function feedback_replied_events() {
return array('\mod_forum\event\assessable_uploaded'); 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;
}
} }

View File

@ -42,4 +42,13 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o
protected function get_activity_type() { protected function get_activity_type() {
return 'lesson'; 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;
}
} }

View File

@ -43,10 +43,6 @@ class cognitive_depth extends activity_base {
return 5; 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) { protected function feedback_submitted(\cm_info $cm, $contextid, $userid, $after = false) {
if (empty($this->activitylogs[$contextid][$userid]) || if (empty($this->activitylogs[$contextid][$userid]) ||
empty($this->activitylogs[$contextid][$userid]['\mod_lesson\event\lesson_ended'])) { 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'])); 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) { protected function feedback_replied(\cm_info $cm, $contextid, $userid, $after = false) {
// No level 4. // No level 4.
return false; return false;

View File

@ -42,4 +42,9 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o
protected function get_activity_type() { protected function get_activity_type() {
return 'lti'; 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');
}
} }

View File

@ -43,9 +43,4 @@ class cognitive_depth extends activity_base {
return 3; 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');
}
} }

View File

@ -42,4 +42,13 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o
protected function get_activity_type() { protected function get_activity_type() {
return 'quiz'; 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');
}
} }

View File

@ -43,15 +43,6 @@ class cognitive_depth extends activity_base {
return 5; 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() { protected function feedback_submitted_events() {
return array('\mod_quiz\event\attempt_submitted'); return array('\mod_quiz\event\attempt_submitted');
} }

View File

@ -42,4 +42,9 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o
protected function get_activity_type() { protected function get_activity_type() {
return 'scorm'; 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');
}
} }

View File

@ -42,9 +42,4 @@ class cognitive_depth extends activity_base {
public function get_cognitive_depth_level(\cm_info $cm) { public function get_cognitive_depth_level(\cm_info $cm) {
return 3; 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');
}
} }

View File

@ -40,6 +40,6 @@ class social_breadth extends activity_base {
} }
protected function get_social_breadth_level(\cm_info $cm) { protected function get_social_breadth_level(\cm_info $cm) {
return 2; return 1;
} }
} }

View File

@ -42,4 +42,12 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o
protected function get_activity_type() { protected function get_activity_type() {
return 'workshop'; 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');
}
} }

View File

@ -43,14 +43,6 @@ class cognitive_depth extends activity_base {
return 5; 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() { protected function feedback_replied_events() {
return array('\mod_workshop\event\submission_assessed', '\mod_workshop\event\submission_reassessed'); return array('\mod_workshop\event\submission_assessed', '\mod_workshop\event\submission_reassessed');
} }