From 1f5d66e203e684286cff5e8975935b113f4ecde3 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Thu, 7 Nov 2024 10:05:49 -0500 Subject: [PATCH] deleted irrelevant constructs filtering function --- .../controllers/get_analytics_controller.dart | 32 +++---------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/lib/pangea/controllers/get_analytics_controller.dart b/lib/pangea/controllers/get_analytics_controller.dart index 181279f3d..a22d826cd 100644 --- a/lib/pangea/controllers/get_analytics_controller.dart +++ b/lib/pangea/controllers/get_analytics_controller.dart @@ -3,7 +3,6 @@ import 'dart:math'; import 'package:fluffychat/pangea/constants/class_default_values.dart'; import 'package:fluffychat/pangea/constants/local.key.dart'; -import 'package:fluffychat/pangea/constants/match_rule_ids.dart'; import 'package:fluffychat/pangea/controllers/pangea_controller.dart'; import 'package:fluffychat/pangea/controllers/put_analytics_controller.dart'; import 'package:fluffychat/pangea/enum/construct_type_enum.dart'; @@ -227,25 +226,20 @@ class GetAnalyticsController { final List constructEvents = await allMyConstructs(); - final List unfilteredUses = []; + final List uses = []; for (final event in constructEvents) { - unfilteredUses.addAll(event.content.uses); + uses.addAll(event.content.uses); } - // filter out any constructs that are not relevant to the user - final List filteredUses = await filterConstructs( - unfilteredConstructs: unfilteredUses, - ); - // if there isn't already a valid, local cache, cache the filtered uses if (local == null) { cacheConstructs( constructType: constructType, - uses: filteredUses, + uses: uses, ); } - return filteredUses; + return uses; } /// Get the last time the user updated their analytics for their current l2 @@ -272,24 +266,6 @@ class GetAnalyticsController { return await analyticsRoom.getAnalyticsEvents(userId: client.userID!) ?? []; } - /// Filter out constructs that are not relevant to the user, specifically those from - /// rooms in which the user is a teacher and those that are interative translation span constructs - /// @ggurdin - is this still relevant now that we're not doing grammar constructs? - /// maybe it should actually be filtering all grammar uses, though this is maybe more efficiently done - /// in the fromJson of the model reading the event content, then maybe we can get rid of that enum entry entirely - Future> filterConstructs({ - required List unfilteredConstructs, - }) async { - return unfilteredConstructs - .where( - (use) => - use.lemma != "Try interactive translation" && - use.lemma != "itStart" || - use.lemma != MatchRuleIds.interactiveTranslation, - ) - .toList(); - } - /// Get the cached construct uses for the current user, if it exists List? getConstructsLocal({ ConstructTypeEnum? constructType,