From e3b6fec11244180a51c01e7aab3a10d4ce8d1a72 Mon Sep 17 00:00:00 2001 From: Steven Lageveen Date: Thu, 17 Oct 2024 11:20:52 +0200 Subject: [PATCH] Fix for usage download --- IguideME.Web/Services/Constants/DatabaseQueries.cs | 8 +------- IguideME.Web/Services/DatabaseManager.cs | 4 ++-- IguideME.Web/appsettings.json | 2 +- charts/iguideme/Chart.yaml | 4 ++-- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/IguideME.Web/Services/Constants/DatabaseQueries.cs b/IguideME.Web/Services/Constants/DatabaseQueries.cs index 853bd2bb..5ef6b927 100644 --- a/IguideME.Web/Services/Constants/DatabaseQueries.cs +++ b/IguideME.Web/Services/Constants/DatabaseQueries.cs @@ -1151,16 +1151,10 @@ ORDER BY `end_timestamp` DESC ORDER BY `name` ASC;"; public const string QUERY_USAGE = - @"SELECT `user_tracker`.`id`, - `user_tracker`.`time`, + @"SELECT `user_tracker`.`time`, `user_tracker`.`user_id`, `user_tracker`.`action` FROM `user_tracker` - INNER JOIN `canvas_users` - ON `canvas_users`.`user_id`=`user_tracker`.`user_id` - WHERE `canvas_users`.`sync_hash`=@hash - AND `canvas_users`.`course_id`=@courseID - GROUP BY `user_tracker`.`user_id` ;"; public const string QUERY_USERS_WITH_ROLE_FOR_COURSE = diff --git a/IguideME.Web/Services/DatabaseManager.cs b/IguideME.Web/Services/DatabaseManager.cs index 143cff99..9c37d07e 100644 --- a/IguideME.Web/Services/DatabaseManager.cs +++ b/IguideME.Web/Services/DatabaseManager.cs @@ -628,7 +628,7 @@ public void RegisterDiscussionReply(AppDiscussion reply) public string GetUsage(int courseID) { _logger.LogInformation("userID: #actions"); - string csv = ""; + string csv = "time, userID, action\r\n"; using ( SQLiteDataReader r = Query( DatabaseQueries.QUERY_USAGE, @@ -639,7 +639,7 @@ public string GetUsage(int courseID) { while (r.Read()) { - csv += $"{r.GetInt32(0)}, {r.GetValue(1)}, {r.GetValue(2)}, {r.GetValue(3)}\r\n"; + csv += $"{r.GetValue(0)}, {r.GetValue(1)}, {r.GetValue(2)}\r\n"; } } return csv; diff --git a/IguideME.Web/appsettings.json b/IguideME.Web/appsettings.json index 5dbbfa46..9cd01ef1 100644 --- a/IguideME.Web/appsettings.json +++ b/IguideME.Web/appsettings.json @@ -17,7 +17,7 @@ "SigningKey": "blawlaekltjwelkrjtwlkejlekwjrklwejr32423" }, "LMS": { - "Backend": "Brightspace", + "Backend": "Canvas", "Canvas": { "Url": "https://uvadlo-tes.instructure.com/", "AccessToken": "10441~hNIJcVXzv25ibhKMqYROQ06GiBlUkpBEs29h25OBUjGUNZfNtvf4MeVgeC3B1O0p" diff --git a/charts/iguideme/Chart.yaml b/charts/iguideme/Chart.yaml index 93155854..01718b6c 100644 --- a/charts/iguideme/Chart.yaml +++ b/charts/iguideme/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: iguideme description: IguideME type: application -version: 0.2.97 -appVersion: "0.2.97" +version: 0.2.98 +appVersion: "0.2.98"