From 8e420879481824bab8335578995f31b9e86bfdca Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 28 Jun 2026 13:56:48 -0500 Subject: add date range selection to exception reports --- src/slskd/Telemetry/ReportsService.cs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/slskd/Telemetry/ReportsService.cs b/src/slskd/Telemetry/ReportsService.cs index c099ef32..e0304d2a 100644 --- a/src/slskd/Telemetry/ReportsService.cs +++ b/src/slskd/Telemetry/ReportsService.cs @@ -362,20 +362,22 @@ public class ReportsService Filename, Size, State, - RequestedAt + RequestedAt, EnqueuedAt, StartedAt, EndedAt, BytesTransferred, AverageSpeed, - CASE - WHEN INSTR(Exception, ':') > 0 + CASE + WHEN INSTR(Exception, ':') > 0 THEN SUBSTR(Exception, INSTR(Exception, ':') + 2) ELSE Exception END as Exception - FROM transfers + FROM transfers WHERE state & ~48 AND Direction = @Direction + AND EndedAt IS NOT NULL + AND EndedAt BETWEEN @Start AND @End {(username is not null ? "AND Username = @Username" : string.Empty)} ORDER BY EndedAt {sortOrder} LIMIT @Limit @@ -433,21 +435,23 @@ public class ReportsService } var sql = @$" - SELECT - CASE - WHEN INSTR(Exception, ':') > 0 + SELECT + CASE + WHEN INSTR(Exception, ':') > 0 THEN SUBSTR(Exception, INSTR(Exception, ':') + 2) ELSE Exception END as Exception, COUNT(*) as Count, COUNT(DISTINCT Username) as DistinctUsers - FROM transfers + FROM transfers WHERE state & ~48 AND Direction = @Direction + AND EndedAt IS NOT NULL + AND EndedAt BETWEEN @Start AND @End {(username is not null ? "AND Username = @Username" : string.Empty)} GROUP BY Direction, - CASE - WHEN INSTR(Exception, ':') > 0 + CASE + WHEN INSTR(Exception, ':') > 0 THEN SUBSTR(Exception, INSTR(Exception, ':') + 2) ELSE Exception END -- cgit v1.2.3