diff --git a/classes/report.php b/classes/report.php index 5b0a868..c5fffde 100644 --- a/classes/report.php +++ b/classes/report.php @@ -33,6 +33,7 @@ function __construct($uniqueid) { $this->define_columns($columns); $this->no_sorting('usermessage'); $this->no_sorting('airesponse'); + $this->sortable(true, 'timecreated', SORT_DESC); // Define the titles of columns to show in header. $headers = array('User ID', 'User Name', 'User Message', 'AI Response', 'Context', 'Time'); diff --git a/report.php b/report.php index ece10c3..ee82a20 100644 --- a/report.php +++ b/report.php @@ -33,7 +33,6 @@ $user = optional_param('user', '', PARAM_TEXT); $starttime = optional_param('starttime', '', PARAM_TEXT); $endtime = optional_param('endtime', '', PARAM_TEXT); -$tsort = optional_param('tsort', '', PARAM_TEXT); $pageurl = $CFG->wwwroot . "/blocks/openai_chat/report.php?courseid=$courseid" . "&user=$user" . @@ -95,9 +94,6 @@ $where .= " AND ocl.timecreated < $endtime_ts"; } -if (!$tsort) { - $where .= " ORDER BY ocl.timecreated DESC"; -} $table->set_sql( "ocl.*, CONCAT(u.firstname, ' ', u.lastname) as user_name",