|
@@ -1969,7 +1969,8 @@ class learnpathItem {
|
|
|
*/
|
|
|
public function set_score($score) {
|
|
|
//$possible_status = array('not attempted','incomplete','completed','passed','failed','browsed');
|
|
|
- if (self::debug > 0) { error_log('learnpathItem::set_score('.$score.')', 0); }
|
|
|
+ $debug = self::debug;
|
|
|
+ if ($debug > 0) { error_log('learnpathItem::set_score('.$score.')', 0); }
|
|
|
if (($this->max_score <= 0 || $score <= $this->max_score) && ($score >= $this->min_score)) {
|
|
|
$this->current_score = $score;
|
|
|
$master = $this->get_mastery_score();
|
|
@@ -1979,7 +1980,8 @@ class learnpathItem {
|
|
|
if ($master == -1) {
|
|
|
$master = $this->max_score;
|
|
|
}
|
|
|
- if (self::debug > 0) {
|
|
|
+
|
|
|
+ if ($debug > 0) {
|
|
|
error_log('get_mastery_score: '.$master);
|
|
|
error_log('current_status: '.$current_status);
|
|
|
error_log('current score : '.$this->current_score);
|
|
@@ -1987,10 +1989,10 @@ class learnpathItem {
|
|
|
|
|
|
// If mastery_score is set AND the current score reaches the mastery score AND the current status is different from 'completed', then set it to 'passed'.
|
|
|
if ($master != -1 && $this->current_score >= $master && $current_status != $this->possible_status[2]) {
|
|
|
- if (self::debug > 0) error_log('Status changed to: '.$this->possible_status[3]);
|
|
|
+ if ($debug > 0) error_log('Status changed to: '.$this->possible_status[3]);
|
|
|
$this->set_status($this->possible_status[3]); //passed
|
|
|
} elseif ($master != -1 && $this->current_score < $master) {
|
|
|
- if (self::debug > 0) error_log('Status changed to: '.$this->possible_status[4]);
|
|
|
+ if ($debug > 0) error_log('Status changed to: '.$this->possible_status[4]);
|
|
|
$this->set_status($this->possible_status[4]); //failed
|
|
|
}
|
|
|
return true;
|