diff --git a/classes/condition/studentquiz_condition.php b/classes/condition/studentquiz_condition.php index 10cf7ac0..cbc878bb 100755 --- a/classes/condition/studentquiz_condition.php +++ b/classes/condition/studentquiz_condition.php @@ -139,11 +139,13 @@ protected function init() { } private function get_special_sql($sqldata, $name) { - if (substr($sqldata, 0, 12) === 'mydifficulty') { - return str_replace('mydifficulty', 'ROUND(1 - (sp.correctattempts / sp.attempts),2)', $sqldata); - } - if ($name == "onlynew") { - return str_replace('myattempts', 'sp.attempts', $sqldata); + if ($this->studentquiz->aggregated) { + if (substr($sqldata, 0, 12) === 'mydifficulty') { + return str_replace('mydifficulty', 'ROUND(1 - (sp.correctattempts / sp.attempts),2)', $sqldata); + } + if ($name == "onlynew") { + return str_replace('myattempts', 'sp.attempts', $sqldata); + } } return $sqldata; }