Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-42957 quiz statistics : Hardcoded sql LIMIT clause

  • Loading branch information...
commit e4b17111a4b44946557e776722d026518f2be32f 1 parent 2b10fa0
@jamiepratt jamiepratt authored
View
3  question/classes/statistics/questions/calculator.php
@@ -250,8 +250,7 @@ public function get_last_calculated_time($qubaids) {
global $DB;
$timemodified = time() - self::TIME_TO_CACHE;
- return $DB->get_field_select('question_statistics', 'timemodified', 'hashcode = ? AND timemodified > ? '.
- 'ORDER BY timemodified DESC LIMIT 1',
+ return $DB->get_field_select('question_statistics', 'timemodified', 'hashcode = ? AND timemodified > ?',
array($qubaids->get_hash_code(), $timemodified));
}
View
7 question/classes/statistics/responses/analyser.php
@@ -137,7 +137,7 @@ public function load_cached($qubaids) {
global $DB;
$timemodified = time() - self::TIME_TO_CACHE;
- $rows = $DB->get_records_select('question_response_analysis', 'hashcode = ? AND questionid = ? AND timemodified > ? ',
+ $rows = $DB->get_records_select('question_response_analysis', 'hashcode = ? AND questionid = ? AND timemodified > ?',
array($qubaids->get_hash_code(), $this->questiondata->id, $timemodified));
if (!$rows) {
return false;
@@ -161,8 +161,7 @@ public function get_last_analysed_time($qubaids) {
global $DB;
$timemodified = time() - self::TIME_TO_CACHE;
- return $DB->get_field_select('question_response_analysis', 'timemodified', 'hashcode = ? AND timemodified > ? '.
- 'ORDER BY timemodified DESC LIMIT 1',
- array($qubaids->get_hash_code(), $timemodified));
+ return $DB->get_field_select('question_response_analysis', 'hashcode = ? AND questionid = ? AND timemodified > ?',
+ array($qubaids->get_hash_code(), $this->questiondata->id, $timemodified), IGNORE_MULTIPLE);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.