From 68b7b6b01900c1b403c01d8d386d8e6707b558d7 Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 27 Aug 2025 13:14:51 +0200 Subject: [PATCH] Set default sort column timecreated. Fix #78 --- classes/report.php | 1 + report.php | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) 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",