Skip to content

Commit

Permalink
MDL-62209 tool_dataprivacy: Sort requests by ascending status
Browse files Browse the repository at this point in the history
Sort requests by ascending status and request date so that the DPO
can go through the list in a FIFO fashion
  • Loading branch information
junpataleta committed Apr 26, 2018
1 parent 641d113 commit 38ffa48
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions admin/tool/dataprivacy/classes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,19 @@ public static function create_data_request($foruser, $type, $comments = '') {
public static function get_data_requests($userid = 0) {
global $USER;
$results = [];
$sort = 'status ASC, timemodified ASC';
if ($userid) {
// Get the data requests for the user or data requests made by the user.
$select = "userid = :userid OR requestedby = :requestedby";
$params = [
'userid' => $userid,
'requestedby' => $userid
];
$results = data_request::get_records_select($select, $params, 'status DESC, timemodified DESC');
$results = data_request::get_records_select($select, $params, $sort);
} else {
// If the current user is one of the site's Data Protection Officers, then fetch all data requests.
if (self::is_site_dpo($USER->id)) {
$results = data_request::get_records(null, 'status DESC, timemodified DESC', '');
$results = data_request::get_records(null, $sort, '');
}
}

Expand Down

0 comments on commit 38ffa48

Please sign in to comment.