From 038e3a92a64c34be10fc4e66be6b44bb9d136469 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 3 Oct 2023 11:27:23 +0300 Subject: [PATCH] Fix sorting reports by bool column --- lib/ui/reports/reports_screen.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ui/reports/reports_screen.dart b/lib/ui/reports/reports_screen.dart index cf5b2e39d..c2c253c14 100644 --- a/lib/ui/reports/reports_screen.dart +++ b/lib/ui/reports/reports_screen.dart @@ -1885,6 +1885,14 @@ int? sortReportTableRows(dynamic rowA, dynamic rowB, final dynamic valueA = rowA[index].value; final dynamic valueB = rowB[index].value; + if (valueA is bool) { + if (reportSettings.sortAscending) { + return valueA ? 1 : -1; + } else { + return valueA ? -1 : 1; + } + } + if (reportSettings.sortAscending) { return valueA.compareTo(valueB); } else {