From 0211ba450eda4e831269329d7465b208d30c632a Mon Sep 17 00:00:00 2001 From: Steven Lageveen Date: Sun, 24 Nov 2024 14:17:15 +0100 Subject: [PATCH] Should fix error retrieving submissions for too many users --- IguideME.Web/Services/LMSHandlers/CanvasHandler.cs | 12 +++++++++++- charts/iguideme/Chart.yaml | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/IguideME.Web/Services/LMSHandlers/CanvasHandler.cs b/IguideME.Web/Services/LMSHandlers/CanvasHandler.cs index 98288cae..de812b02 100644 --- a/IguideME.Web/Services/LMSHandlers/CanvasHandler.cs +++ b/IguideME.Web/Services/LMSHandlers/CanvasHandler.cs @@ -185,7 +185,17 @@ private AppGradingType mapGradingType(GradingType type) /// public IEnumerable GetSubmissions(int courseID, List users) { - _logger.LogInformation("Getting submissions for users:\n{}", users.Select(user => user.UserID)); + List submissions = new(); + for (int i = 0; i < users.Count; i += 100) + { + submissions.Concat(GetSubmissionsBatch(courseID, users.GetRange(i, Math.Min(100, users.Count - i)))); + }; + return submissions; + + } + + public IEnumerable GetSubmissionsBatch(int courseID, List users) + { return Connector .FindCourseById(courseID) .GetSubmissions(users.Select(user => user.UserID).ToArray(), false) diff --git a/charts/iguideme/Chart.yaml b/charts/iguideme/Chart.yaml index db4a3f2c..c2cd25c1 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.3.239 -appVersion: "0.3.239" +version: 0.3.240 +appVersion: "0.3.240"