Skip to content

Commit

Permalink
Fixed rare filtering issue for old studentquiz instances
Browse files Browse the repository at this point in the history
  • Loading branch information
muqiuq committed Feb 13, 2019
1 parent f62e9ec commit d89ce46
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions classes/condition/studentquiz_condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit d89ce46

Please sign in to comment.