Skip to content

Commit

Permalink
Merge branch 'MDL-71838' of https://github.com/timhunt/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jun 10, 2021
2 parents 4af7195 + 1287eca commit d3654c3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions mod/quiz/report/overview/overview_table.php
Expand Up @@ -70,23 +70,25 @@ public function build_table() {
$this->add_separator();

if (!empty($this->groupstudentsjoins->joins)) {
$sql = "SELECT DISTINCT u.id
$hasgroupstudents = $DB->record_exists_sql("
SELECT 1
FROM {user} u
{$this->groupstudentsjoins->joins}
WHERE {$this->groupstudentsjoins->wheres}";
$groupstudents = $DB->get_records_sql($sql, $this->groupstudentsjoins->params);
if ($groupstudents) {
WHERE {$this->groupstudentsjoins->wheres}
", $this->groupstudentsjoins->params);
if ($hasgroupstudents) {
$this->add_average_row(get_string('groupavg', 'grades'), $this->groupstudentsjoins);
}
}

if (!empty($this->studentsjoins->joins)) {
$sql = "SELECT DISTINCT u.id
$hasstudents = $DB->record_exists_sql("
SELECT 1
FROM {user} u
{$this->studentsjoins->joins}
WHERE {$this->studentsjoins->wheres}";
$students = $DB->get_records_sql($sql, $this->studentsjoins->params);
if ($students) {
WHERE {$this->studentsjoins->wheres}
" , $this->studentsjoins->params);
if ($hasstudents) {
$this->add_average_row(get_string('overallaverage', 'grades'), $this->studentsjoins);
}
}
Expand Down

0 comments on commit d3654c3

Please sign in to comment.