Skip to content

Commit

Permalink
MDL-55082 search: Update core areas to return results in time ASC order
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmerrill committed Jun 30, 2016
1 parent b8474fe commit 55b6237
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion course/classes/search/mycourse.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class mycourse extends \core_search\area\base {
*/
public function get_recordset_by_timestamp($modifiedfrom = 0) {
global $DB;
return $DB->get_recordset_select('course', 'timemodified >= ?', array($modifiedfrom));
return $DB->get_recordset_select('course', 'timemodified >= ?', array($modifiedfrom), 'timemodified ASC');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion mod/glossary/classes/search/entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function get_recordset_by_timestamp($modifiedfrom = 0) {

$sql = "SELECT ge.*, g.course FROM {glossary_entries} ge
JOIN {glossary} g ON g.id = ge.glossaryid
WHERE ge.timemodified >= ?";
WHERE ge.timemodified >= ? ORDER BY ge.timemodified ASC";
return $DB->get_recordset_sql($sql, array($modifiedfrom));
}

Expand Down
3 changes: 2 additions & 1 deletion mod/survey/classes/search/activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class activity extends \core_search\area\base_activity {
public function get_recordset_by_timestamp($modifiedfrom = 0) {
global $DB;
$select = 'course != ? AND ' . static::MODIFIED_FIELD_NAME . ' >= ?';
return $DB->get_recordset_select($this->get_module_name(), $select, array(0, $modifiedfrom));
return $DB->get_recordset_select($this->get_module_name(), $select, array(0, $modifiedfrom),
static::MODIFIED_FIELD_NAME . ' ASC');
}

}
3 changes: 2 additions & 1 deletion search/classes/area/base_activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ abstract class base_activity extends base_mod {
*/
public function get_recordset_by_timestamp($modifiedfrom = 0) {
global $DB;
return $DB->get_recordset_select($this->get_module_name(), static::MODIFIED_FIELD_NAME . ' >= ?', array($modifiedfrom));
return $DB->get_recordset_select($this->get_module_name(), static::MODIFIED_FIELD_NAME . ' >= ?', array($modifiedfrom),
static::MODIFIED_FIELD_NAME . ' ASC');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions search/tests/fixtures/mock_search_area.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public function is_enabled() {
public function get_recordset_by_timestamp($modifiedfrom = 0) {
global $DB;

// Filter by capability as we want this quick.
return $DB->get_recordset_sql("SELECT * FROM {temp_mock_search_area} WHERE timemodified >= ?", array($modifiedfrom));
$sql = "SELECT * FROM {temp_mock_search_area} WHERE timemodified >= ? ORDER BY timemodified ASC";
return $DB->get_recordset_sql($sql, array($modifiedfrom));
}

public function get_document($record, $options = array()) {
Expand Down

0 comments on commit 55b6237

Please sign in to comment.