diff --git a/lib/pangea/models/analytics/constructs_model.dart b/lib/pangea/models/analytics/constructs_model.dart index 85bd16d40..e4e006952 100644 --- a/lib/pangea/models/analytics/constructs_model.dart +++ b/lib/pangea/models/analytics/constructs_model.dart @@ -108,7 +108,7 @@ class OneConstructUse { : null; debugger(when: kDebugMode && constructType == null); - final categoryEntry = json['categories']; + final categoryEntry = json['cat'] ?? json['categories']; String? category; if (categoryEntry != null) { if ((categoryEntry is List) && categoryEntry.isNotEmpty) { diff --git a/lib/pangea/models/practice_activities.dart/practice_activity_model.dart b/lib/pangea/models/practice_activities.dart/practice_activity_model.dart index 34ea62db0..ccdd3802a 100644 --- a/lib/pangea/models/practice_activities.dart/practice_activity_model.dart +++ b/lib/pangea/models/practice_activities.dart/practice_activity_model.dart @@ -21,10 +21,14 @@ class ConstructIdentifier { }); factory ConstructIdentifier.fromJson(Map json) { - final categoryEntry = json['cat']; + final categoryEntry = json['cat'] ?? json['categories']; String? category; - if (categoryEntry != null && categoryEntry is String) { - category = categoryEntry; + if (categoryEntry != null) { + if (categoryEntry is String) { + category = categoryEntry; + } else if (categoryEntry is List) { + category = categoryEntry.first; + } } try { @@ -46,6 +50,7 @@ class ConstructIdentifier { return { 'lemma': lemma, 'type': type.string, + 'cat': category, }; }