From fbb43fee6e7a49ae7bfb6b8dcac4da88b023d32c Mon Sep 17 00:00:00 2001 From: Ava Shilling <165050625+avashilling@users.noreply.github.com> Date: Wed, 28 Jan 2026 17:14:18 -0500 Subject: [PATCH] chore: skip recently practiced grammar errors wip: only partially works due to analytics not being given to every question --- .../analytics_practice_session_repo.dart | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/pangea/analytics_practice/analytics_practice_session_repo.dart b/lib/pangea/analytics_practice/analytics_practice_session_repo.dart index c12b82d3c..65c9cd7e0 100644 --- a/lib/pangea/analytics_practice/analytics_practice_session_repo.dart +++ b/lib/pangea/analytics_practice/analytics_practice_session_repo.dart @@ -160,7 +160,8 @@ class AnalyticsPracticeSessionRepo { feature == MorphFeaturesEnum.Poss || feature == MorphFeaturesEnum.Reflex || feature == MorphFeaturesEnum.PrepCase || - feature == MorphFeaturesEnum.NumType) { + feature == MorphFeaturesEnum.NumType || + feature == MorphFeaturesEnum.NumForm) { continue; } @@ -305,6 +306,29 @@ class AnalyticsPracticeSessionRepo { if (choiceTokens.length <= 1) { continue; } + + // Check if the first token was practiced in the last 24 hours + final cutoffTime = DateTime.now().subtract(const Duration(hours: 24)); + final firstToken = choiceTokens.first; + final tokenIdentifier = ConstructIdentifier( + lemma: firstToken.lemma.text, + type: ConstructTypeEnum.vocab, + category: firstToken.pos, + ); + + final recentUses = await MatrixState + .pangeaController.matrixState.analyticsDataService + .getUses(since: cutoffTime); + + final hasRecentPractice = recentUses.any( + (use) => + use.identifier == tokenIdentifier && + (use.useType == ConstructUseTypeEnum.corGE || + use.useType == ConstructUseTypeEnum.incGE), + ); + + if (hasRecentPractice) continue; + String? translation; try { translation = await event.requestRespresentationByL1(); @@ -321,6 +345,7 @@ class AnalyticsPracticeSessionRepo { } if (translation == null) continue; + targets.add( AnalyticsActivityTarget( target: PracticeTarget(