MDL-59931 mod_quiz: Fixing incorrect pagination count.
authorCarson Tam <carson.tam@ucsf.edu>
Fri, 15 Sep 2017 14:53:35 +0000 (07:53 -0700)
committerCarson Tam <carson.tam@ucsf.edu>
Mon, 25 Sep 2017 19:46:52 +0000 (12:46 -0700)
mod/quiz/report/overview/report.php
mod/quiz/report/responses/report.php

index 71cb1b0..f2beb68 100644 (file)
@@ -138,7 +138,7 @@ class quiz_overview_report extends quiz_attempts_report {
             // Construct the SQL.
             list($fields, $from, $where, $params) = $table->base_sql($allowedjoins);
 
             // Construct the SQL.
             list($fields, $from, $where, $params) = $table->base_sql($allowedjoins);
 
-            $table->set_count_sql("SELECT COUNT(1) FROM $from WHERE $where", $params);
+            $table->set_count_sql("SELECT COUNT(1) FROM (SELECT $fields FROM $from WHERE $where) temp", $params);
 
             // Test to see if there are any regraded attempts to be listed.
             $fields .= ", COALESCE((
 
             // Test to see if there are any regraded attempts to be listed.
             $fields .= ", COALESCE((
index debfa87..2d41ef3 100644 (file)
@@ -151,7 +151,7 @@ class quiz_responses_report extends quiz_attempts_report {
 
             list($fields, $from, $where, $params) = $table->base_sql($allowedjoins);
 
 
             list($fields, $from, $where, $params) = $table->base_sql($allowedjoins);
 
-            $table->set_count_sql("SELECT COUNT(1) FROM $from WHERE $where", $params);
+            $table->set_count_sql("SELECT COUNT(1) FROM (SELECT $fields FROM $from WHERE $where) temp", $params);
 
             $table->set_sql($fields, $from, $where, $params);
 
 
             $table->set_sql($fields, $from, $where, $params);