log error if there's more than 1 'other' category in analytics (#1109)

This commit is contained in:
ggurdin 2024-11-26 15:41:04 -05:00 committed by GitHub
parent 4ac9a6e005
commit 7e34f40a48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
}