diff --git a/lib/pangea/analytics_practice/analytics_practice_session_repo.dart b/lib/pangea/analytics_practice/analytics_practice_session_repo.dart index 3884dfc19..6a6ef66cf 100644 --- a/lib/pangea/analytics_practice/analytics_practice_session_repo.dart +++ b/lib/pangea/analytics_practice/analytics_practice_session_repo.dart @@ -1,5 +1,7 @@ import 'dart:math'; +import 'package:flutter/material.dart'; + import 'package:fluffychat/pangea/analytics_misc/construct_type_enum.dart'; import 'package:fluffychat/pangea/analytics_misc/construct_use_type_enum.dart'; import 'package:fluffychat/pangea/analytics_practice/analytics_practice_constants.dart'; @@ -238,12 +240,19 @@ class AnalyticsPracticeSessionRepo { for (int i = 0; i < choreo.choreoSteps.length; i++) { final step = choreo.choreoSteps[i]; final igcMatch = step.acceptedOrIgnoredMatch; + final stepText = choreo.stepText(stepIndex: i - 1); if (igcMatch?.isGrammarMatch != true || igcMatch?.match.bestChoice == null) { continue; } - final choices = igcMatch!.match.choices!.map((c) => c.value).toList(); + if (igcMatch!.match.offset == 0 && + igcMatch.match.length >= stepText.trim().characters.length) { + // Skip if the grammar error spans the entire step + continue; + } + + final choices = igcMatch.match.choices!.map((c) => c.value).toList(); final choiceTokens = tokens .where( (token) => diff --git a/lib/pangea/events/event_wrappers/pangea_message_event.dart b/lib/pangea/events/event_wrappers/pangea_message_event.dart index de462ed95..67809bb92 100644 --- a/lib/pangea/events/event_wrappers/pangea_message_event.dart +++ b/lib/pangea/events/event_wrappers/pangea_message_event.dart @@ -593,7 +593,6 @@ class PangeaMessageEvent { } Future requestRespresentationByL1() async { - debugPrint("LATEST EDIT: ${_latestEdit.toJson()}"); if (_l1Code == null || _l2Code == null) { throw Exception("Missing language codes"); } @@ -605,9 +604,7 @@ class PangeaMessageEvent { RepresentationEvent? rep; if (!includedIT) { // if the message didn't go through translation, get any l1 rep - debugPrint("REPRESENTATIONS: ${representations.length}"); rep = representationByLanguage(_l1Code!); - debugPrint("REP: $rep"); } else { // if the message went through translation, get the non-original // l1 rep since originalWritten could contain some l2 words @@ -624,13 +621,6 @@ class PangeaMessageEvent { ? (originalWritten?.langCode ?? _l1Code!) : (originalSent?.langCode ?? _l2Code!); - debugPrint("Original written content: $originalWrittenContent"); - debugPrint("Message display text: $messageDisplayText"); - debugPrint("Original sent: ${originalSent?.content.toJson()}"); - debugPrint( - "Message display rep: ${representationByLanguage(messageDisplayLangCode)?.content.toJson()}", - ); - final resp = await _requestRepresentation( includedIT ? originalWrittenContent : messageDisplayText, _l1Code!,