From 7e34f40a4865272b72008e914f1c44210f752dee Mon Sep 17 00:00:00 2001 From: ggurdin <46800240+ggurdin@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:41:04 -0500 Subject: [PATCH] log error if there's more than 1 'other' category in analytics (#1109) --- .../models/analytics/construct_list_model.dart | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/pangea/models/analytics/construct_list_model.dart b/lib/pangea/models/analytics/construct_list_model.dart index bcdf45f3d..0af074dfa 100644 --- a/lib/pangea/models/analytics/construct_list_model.dart +++ b/lib/pangea/models/analytics/construct_list_model.dart @@ -119,6 +119,22 @@ class ConstructListModel { // Add each item in this entry to the groupedByCategory map under the single category key groupedByCategory.putIfAbsent(category, () => []).addAll(entry.value); } + final others = groupedByCategory.entries + .where((entry) => entry.key.toLowerCase() == 'other') + .toList(); + if (others.length > 1) { + ErrorHandler.logError( + e: "More than one 'other' category in groupedByCategory", + data: { + "others": others + .map( + (entry) => + ("${entry.key}: ${entry.value.map((uses) => uses.id.string).toList()}"), + ) + .toList(), + }, + ); + } _categoriesToUses = groupedByCategory; }