Skip to content

Commit

Permalink
MDL-59030 analytics: Social breadth accepting more than level 2
Browse files Browse the repository at this point in the history
Even if core indicators are limited to level 2 we should not block
other activities from implementing up to level 5.
  • Loading branch information
David Monllao committed Aug 29, 2017
1 parent e8c2abc commit f07d93d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ abstract class community_of_inquiry_activity extends linear {
/**
* Max social breadth level accepted.
*/
const MAX_SOCIAL_LEVEL = 2;
const MAX_SOCIAL_LEVEL = 5;

/**
* Returns the activity type. No point in changing this class in children classes.
Expand Down Expand Up @@ -604,13 +604,18 @@ protected function social_calculate_sample($sampleid, $tablename, $starttime = f

$potentiallevel = $this->get_social_breadth_level($cm);
if (!is_int($potentiallevel) || $potentiallevel > self::MAX_SOCIAL_LEVEL || $potentiallevel < 1) {
throw new \coding_exception('Although social breadth levels can go from 1 to 5 at the moment Moodle core ' .
'can only accept social breadth levels between 1 and ' . self::MAX_SOCIAL_LEVEL . '. Sorry for the ' .
'inconvenience. This will change in future releases.');
throw new \coding_exception('Activities\' potential social breadth go from 1 to ' .
community_of_inquiry_activity::MAX_SOCIAL_LEVEL . '.');
}
$scoreperlevel = $scoreperactivity / $potentiallevel;
switch ($potentiallevel) {
case 2:
case 3:
case 4:
case 5:
// Core activities social breadth only reaches level 2, until core activities social
// breadth do not reach level 5 we limit it to what we currently support, which is level 2.

// Social breadth level 2 is to view feedback. (Same as cognitive level 3).

if ($this->any_feedback('viewed', $cm, $contextid, $user)) {
Expand Down
10 changes: 8 additions & 2 deletions course/classes/analytics/indicator/potential_social_breadth.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ public function calculate_sample($sampleid, $sampleorigin, $notusedstarttime = f
}
}

// Core activities social breadth only reaches level 2, until core activities social
// breadth do not reach level 5 we limit it to what we currently support, which is level 2.
if ($potentiallevel > 2) {
$potentiallevel = 2;
}

// Supporting only social breadth level 1 and 2 the possible values are -1 or 1.
$levelscore = round(self::get_max_value() - self::get_min_value(), 2);

Expand Down Expand Up @@ -136,7 +142,7 @@ protected function get_social_indicator($modname) {
* @param int $level
*/
protected function level_not_accepted($level) {
throw new \coding_exception('Although social breadth levels can go from 1 to 5 at the moment Moodle core can only accept' .
' social breadth levels 1 and 2. Sorry for the inconvenience, this will change in future releases.');
throw new \coding_exception('Activities\' potential social breadth go from 1 to ' .
community_of_inquiry_activity::MAX_SOCIAL_LEVEL . '.');
}
}

0 comments on commit f07d93d

Please sign in to comment.